/    Sign up×
Community /Pin to ProfileBookmark

They both work

They both work BUT which is better and more correct to use

[code=html]src=”images/rate/1.gif” onMouseOut=this.src=”images/rate/1.gif” onMouseOver=this.src=”images/rate/1c.gif”

or

src=”images/rate/1.gif” onMouseOut=”this.src=’images/rate/1.gif’;” onMouseOver=”this.src=’images/rate/1c.gif’;”[/code]

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@Jeff_MottAug 03.2007 — Neither is more correct than the other. Though I think the first is easier for my eyes to read.
Copy linkTweet thisAlerts:
@Declan1991Aug 03.2007 — Neither is more correct than the other. Though I think the first is easier for my eyes to read.[/QUOTE]

Isn't the second more correct because it is a correct statement which is what "onMouseOut" accepts?
Copy linkTweet thisAlerts:
@Jeff_MottAug 04.2007 — Oh, sorry. I didn't notice the difference in quotes at first. All I saw was the difference in semi-colons. But now that I see the most important difference, the first is actually not correct at all, and you should use the second. Declan1991 is absolutely correct.
Copy linkTweet thisAlerts:
@KorAug 04.2007 — it depends on the page's Doctype.

If HTML strict, the second one is correct (as you must quote the javascript action).

If XHTML [I]none of them[/I] is correct, as you must use lowercase for event handlers.

Thus, the correct cross DTD syntax should be:
<i>
</i>src="images/rate/1.gif" on[COLOR="Red"]m[/COLOR]ouse[COLOR="Red"]o[/COLOR]ut="this.src='images/rate/1.gif';" on[COLOR="Red"]m[/COLOR]ouse[COLOR="Red"]o[/COLOR]ver="this.src='images/rate/1c.gif';"
×

Success!

Help @oo7ml 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 6.15,
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: @nearjob,
tipped: article
amount: 1000 SATS,

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

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...