PDA

View Full Version : What's with this swap


Awesomesteveh
12-25-2001, 05:07 PM
<script language=javascript>
<!--
if(window.document.images){
var click=new Image();
click.src="click.jpg";

var click2=new Image();
click2.src="click2.jpg";

var click3=new Image();
click3.src="click3.jpg";

var click4=new Image();
click4.src="click4.jpg";}
//-->
</script>

<a href="#"
onmouseOver="if(window.document.images){window.document.click.src=click2.src;}"
onmouseOut="if(window.document.images)
{window.document.click.src=click.src;}"
onClick="return false;"><img src="click.jpg"></a>

<a href="#"
onmouseOver="if(window.document.images)
{window.document.click3.src=click4.src;}"
onmouseOut="if(window.document.images)
{window.document.click3.src=click3.src;}"
onClick="return false;"><img src="click3.jpg"></a>

scoutt
12-27-2001, 01:17 PM
I fail to see what you are asking.

it looks like it is pre-loading the images so you can use them for mouseovers. is that what you wanted to know?

Awesomesteveh
12-27-2001, 10:59 PM
Sorry, for not making this clear but everytime I test the scripting it doesn't work. I was wondering if there was anything you could see that might prevent the swap from happening. Everytime I use the variables set in the pre-load(window.document.click.src=click2.src) the script never works. If I use window.document.click.src="click.jpg" and in the image tag set the src that'ss be used in the swap it <img src=blaa.jpg name=klick"> it works just fine.

mighty_muke
12-28-2001, 04:01 PM
You'll probably need to name your image so the browser knows what image to change

ie
<img src="click.jpg" name="click">
<img src="click3.jpg" name="click3">

MM.