/    Sign up×
Community /Pin to ProfileBookmark

Javascript image swap and preload.

Hello,
I got a javascript from javascript.internet.com genarators that swaps images. When I look at it in my browser it shows the images as red Xs but when I hover over it the onmouse picture comes up then when I move my mouse the the mouseoff picture comes up and stays. Everything works except for the red x in the beginning.

Here’s my script, maybe I did somthing wrong.

Thanks,
Louis 🙂

<HEAD>

<SCRIPT LANGUAGE=”JavaScript”>

<!– Begin

image1 = new Image();
image1.src = “email me.gif”;

image2 = new Image();
image2.src = “email me with.gif”;

// End –>
</script>
</HEAD>

<!– STEP TWO: Insert this code into the BODY of your HTML document –>

<BODY>

<a href=”index.htm” onmouseover=”image1.src=’email me with.gif’;”
onmouseout=”image1.src=’email me.gif’;”>
<img name=”image1″ src=”email me.gif” border=0></a>

<a href=”replace” onmouseover=”image2.src=’email me with.gif’;”
onmouseout=”image2.src=’email me.gif’;”>
<img name=”image2″ src=”email me.gif” border=0></a>

<a href=”” onmouseover=”image3.src=’email me with.gif’;”
onmouseout=”image3.src=’email me.gif’;”>
<img name=”image3″ src=”email me.gif” border=0></a>

</BODY>

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@JonaFeb 19.2005 — [font=trebuchet ms]Try changing the names of your filenames so that there are no spaces in them, then update your script. Also make sure that the images are in the same directory as the HTML file you posted.[/font]
×

Success!

Help @bahamalouie spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...