[Javascript] Re-assign URL of swapped image

Roger Roelofs rer at datacompusa.com
Mon Jun 30 22:08:07 CDT 2003


Thierry,

I'm sure we can point you in the right direction, but at the moment all 
the icky GoLive CyberStudio code is making my head spin.  An image swap 
in javascript is quite simple really,

document.images['Cover'].src = 
"../../../../images/product/Covers/BummiCotton_Bear_M.jpg";

To open a new window with a bigger version, Do you want them to click 
the bigger picture already displayed?  if so, wrap your <img> in an <a> 
with an onClick to open the new window.  You can find out which of the 
two images is currently displayed by

if(document.images['Cover'].src == 
"../../../../images/product/Covers/BummiCotton_Bear_M.jpg") {
	winURL = "../../../../images/product/Covers/BummiCotton_Bear_L.jpg";
} else {
	winURL = "../../../../images/product/Covers/BummiCotton_Cow_L.jpg";
}
window.open(...);

You probably don't want to hear this, but hand coded 
html/css/javascript is _much_ easier to extend and debug.

On Monday, Jun 30, 2003, at 22:00 America/Detroit, Thierry Lavallée 
wrote:

> Hi,
> Please see
> http://www.8p-design.com/Bummis/New/en/Products/covers/BummiCotton.html
>
> When you click on the two swatches, the diaper image swap. All fine.
> Now, I would like the user to click on the swapped image and get 
> directed to
> a LARGER copy of the image in another window. But, I don't know how to 
> swap
> the URL when changing the image.
>
> Could someone guide?
>
> Also, if someone has a better/cleaner javascript than the one I'm 
> using for
> this image swap, please point it to me. This one works, but seems 
> bulky for
> nothing.
>
> Thanks!
> -- 
> Thierry
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
>



More information about the Javascript mailing list