[Javascript] changing image src

Marcelo Simon grillo at lazzuri.com.br
Fri Jun 20 10:48:23 CDT 2003


thanks,

but still is a no go.

I've the images preloaded, and reading your post I have tried to do this

var bt02 = '_img/bt_02radio_off.gif';

function radio(){
    bt02 = '_img/bt_02radio_off.gif';
}

and on the button

<img src="<script>bt02</script>" ...

but it not worked

thanks again
Marcelo Simon

----- Original Message -----
From: "Peter Brunone" <peter at brunone.com>
To: "[JavaScript List]" <javascript at LaTech.edu>
Sent: Friday, June 20, 2003 12:47 PM
Subject: RE: [Javascript] changing image src


> 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
> |
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
>




More information about the Javascript mailing list