HighDots Forums  

swap image in netscape

Javascript JavaScript language (comp.lang.javascript)


Discuss swap image in netscape in the Javascript forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
mr_burns
 
Posts: n/a

Default swap image in netscape - 04-21-2004 , 08:01 AM






hi, i am using the following to change an image from one to another.
below is a stripped down version of the code i am using:



function swaptheimage () {

document.GetElementById('theimage').src = 'images/newimage.gif';

}



this works fine in Internet Explorer, but in Netscape what would i
replace 'document.GetElementById('theimage').src' with??? cheers

burnsy

Reply With Quote
  #2  
Old   
Grunken
 
Posts: n/a

Default Re: swap image in netscape - 04-21-2004 , 08:17 AM






Impresive it works in Internet Explorer )

Remember : Java script is case sensitive!

document.getElementById('theimage').src = 'images/newimage.gif';

Kind Regards

Nick

"mr_burns" <bissatch (AT) yahoo (DOT) co.uk> wrote

Quote:
hi, i am using the following to change an image from one to another.
below is a stripped down version of the code i am using:



function swaptheimage () {

document.GetElementById('theimage').src = 'images/newimage.gif';

}



this works fine in Internet Explorer, but in Netscape what would i
replace 'document.GetElementById('theimage').src' with??? cheers

burnsy



Reply With Quote
  #3  
Old   
Michael Winter
 
Posts: n/a

Default Re: swap image in netscape - 04-21-2004 , 08:31 AM



On 21 Apr 2004 05:01:52 -0700, mr_burns <bissatch (AT) yahoo (DOT) co.uk> wrote:

Quote:
hi, i am using the following to change an image from one to another.
below is a stripped down version of the code i am using:

function swaptheimage () {
document.GetElementById('theimage').src = 'images/newimage.gif';
}

this works fine in Internet Explorer, but in Netscape what would i
replace 'document.GetElementById('theimage').src' with??? cheers
A simpler and more reliable solution is

document.images[ 'theimage' ].src = URL;

Mike


Please don't use tabs to indent code when posting to newsgroups. Change
them to spaces: between two and four.

--
Michael Winter
M.Winter (AT) blueyonder (DOT) co.invalid (replace ".invalid" with ".uk" to reply)


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.