/    Sign up×
Community /Pin to ProfileBookmark

error with mouse event

i jhave this code an i get an error that the
BaskedFoodOn.jpg is undefined why?

[QUOTE]

<img

src=”BasketFoodOff.JPG” style=”cursor:hand”

onmouseover=’this.img=BasketFoodOn.JPG’

onmouseleave=’this.img=BasketFoodOff.JPG’

onpress=”http://www.malka.org.il/food.html“>

[/QUOTE]

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@Tim158May 06.2004 — I will not even try to correct that because more of it is wrong than right lol.

Here's the code you are after:

<a href="myLink.html"><img border="0" name="myImage" src="image.jpg" onmouseover="document.all.myImage.src='mouseOverImage.jpg'" onmouseout="document.all.myImage.src='startingImage.jpg'" /></a>

I have not tested this but it should work (fingers crossed).
Copy linkTweet thisAlerts:
@fredmvMay 06.2004 — The above will only work in IE due to the use of [font=courier]document.all[/font]. You can get it working in all browsers using the following:&lt;a href="foo.html"&gt;&lt;img src="foo.png" onmouseover="src='bar.png';" onmouseout="src='foo.png';" /&gt;&lt;/a&gt;Of course, change filenames accordingly. You could also use pure CSS for this as described on [url=http://www.pixy.cz/blogg/clanky/cssnopreloadrollovers/]this page[/url].
×

Success!

Help @pelegk1 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.19,
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,
)...