[Javascript] changing image src

Peter Brunone peter at brunone.com
Fri Jun 20 10:47:33 CDT 2003


Marcelo,

	I don't know that this would help your current situation, but have you
tried preloading the images?  Something like

var bt_02radio_off = new Image();
bt_02radio_off.src = '_img/bt_02radio_off.gif';

then instead of setting the image source to the file itself, you set it to
the variable where the image has been preloaded.  If nothing else, this will
make the transition quicker than it would be without the preloaded images.

Cheers,

Peter

|-----Original Message-----
|From: javascript-bounces at LaTech.edu
|[mailto:javascript-bounces at LaTech.edu]On Behalf Of Marcelo Simon
|Sent: Friday, June 20, 2003 10:25 AM
|To: [JavaScript List]
|Subject: Re: [Javascript] changing image src
|
|
|Hi,
|
|I've tried all the suggestions, but it didn't work.
|
|I was thinking that it has something to do with the mouseover and mouseout
|actions of the button, but this will be very weird because the both images
|should be the _on.gif, at least is what I think, please correct me if I'm
|wrong.
|
|I've added an alert(document.bt_02.src); in the end of the fuction and it's
|displaying me that the src is the _on one, but that's not what I see on the
|screen, very wierd.
|
|if anyone has another suggestion please share ...
|
|Thanks
|Marcelo Simon
|
|----- Original Message -----
|From: "Geoff Corriere" <geoff at cpe1.com>
|To: "[JavaScript List]" <javascript at LaTech.edu>
|Sent: Friday, June 20, 2003 12:15 PM
|Subject: Re: [Javascript] changing image src
|
|
|> Have you tried changing the order of statements in your function?
|>
|> current order
|> > function midiaext(){
|> >  parent.img.location.href='04_midiaext/04_00_img.htm';
|> >  parent.txt.location.href='04_midiaext/04_txt.htm';
|> >  parent.tit.location.href='04_midiaext/04_tit.htm';
|> >  parent.nota.location.href='04_midiaext/04_00_nota.htm'
|> >  document.bt_02.src = '_img/bt_02radio_off.gif';
|> >  document.bt_03.src = '_img/bt_03internet_off.gif';
|> >  document.bt_04.src = '_img/bt_04midiaext_on.gif';
|> > }
|>
|> possible new order
|> function midiaext(){
|>   document.bt_02.src = '_img/bt_02radio_off.gif';
|>   document.bt_03.src = '_img/bt_03internet_off.gif';
|>   document.bt_04.src = '_img/bt_04midiaext_on.gif';
|> parent.img.location.href='04_midiaext/04_00_img.htm';
|>   parent.txt.location.href='04_midiaext/04_txt.htm';
|>   parent.tit.location.href='04_midiaext/04_tit.htm';
|>   parent.nota.location.href='04_midiaext/04_00_nota.htm'
|> }
|>
|> Geoff
|>
|> _______________________________________________
|> Javascript mailing list
|> Javascript at LaTech.edu
|> https://lists.LaTech.edu/mailman/listinfo/javascript
|>
|
|
|_______________________________________________
|Javascript mailing list
|Javascript at LaTech.edu
|https://lists.LaTech.edu/mailman/listinfo/javascript
|



More information about the Javascript mailing list