Search
Left Quote    It is possible to store the mind with a million facts and still be entirely uneducated.
- Alec Bourne    
Right Quote
 
[login] | [Register]
Forum Index » Java and JavaScript » Viewing Topic and Replies
Post Reply


        Viewing Topic: Change Image
  This user is offline  David1159
  Subject: "Change Image" Posted: @ 1:32 am on Nov 08 2008   

Member #: 526
Rank: User - (81)
Since: 12/27/07
Posts: 81
From: usa

I do not want it done with rollover or event call.

I have a <IMG> tag on my site, when it is called by a function, I want that image to change.


Code:


//I call talks in script, tested and works
talks();

//function to change image, doesn't work
function talks() {
talk = new Image();
talk.src = "talking.g if";
document.talkIM G.src = talk.src;
}

//Image tag that needs to be changed
<img id="talkin g" src="1.gif " name="talk IMG">



I am not to hot yet in java, so can anyone point me in the right direction.

Thanks,
David


Coding is simply CST... Combining $hit Together. We make different $hit to run in unison correctly.
    Viewed: 5,359 Times | Reply to This | To top
  This user is offline  misterhaan
  Subject: "re: Change Image" Posted: @ 3:43 pm on Nov 10 2008    

Member #: 5
Rank: User - (213)
Since: 02/11/05
Posts: 148
From: chair

instead of document.talkIM G.src, try document.getEle mentById(" ;talking"< img src=http://www. allsyntax.com/f orums/images/sm ilies/wink.gif border=0>.src -- i think document.talkin g.src may also work, but getElementById( ) is recommended.

also, i'm not sure what purpose your talks variable serves -- couldn't you just set the src of the actual img tag without putting it in a separate variable first?




please note that the above post is likely made up in its entirety.

    Viewed: 5,337 Times | Reply to This | To top
  This user is offline  David1159
  Subject: "re: Change Image" Posted: @ 6:28 pm on Nov 10 2008    

Member #: 526
Rank: User - (81)
Since: 12/27/07
Posts: 81
From: usa

Thanks, though I tried the getElementById before and it didn't work. I have one image that I need to turn to another image than back to its original image.

I want to make the webpage to talk back to the user. I have a robotic face gif, that just bobbles around when nothing is done. But when you click on something, lets say TIME, I need the gif image to change to the animated talking robotic face gif. Than I after the time is finished to switch back to the non-talk gif.

I finished all the talking with user interactions, voices, etc, this is the last step just getting a image to turn on and off when the webpage is talking.




Coding is simply CST... Combining $hit Together. We make different $hit to run in unison correctly.

    Viewed: 5,333 Times | Reply to This | To top
Viewing Page: 1 of 1


1 |

You must be logged in to post on the forums. Login or Register








"AllSyntax.com" Copyright © 2002-2018; All rights lefted, all lefts righted.
Privacy Policy  |  Internet Rank