Jump to content

this.className vs. class:hover


johnnyk

Recommended Posts

Is there any difference between using:

[code]div {
css
}
div:hover {
different css
}

<div>asdf</div>[/code]

AND

[code]div {
css
}
div.different {
different css
}

<div onmouseover="this.className='different'">asdf</div>[/code]

The only differece I know of is that the first one doesn't work in IE6...but fuck IE6 it's a piece of shit (IE makes me angry). Besides that is there any difference?
Link to comment
Share on other sites

ie 7 supports :hover on all elements and i guess pretty much everyone with ie6 will upgrade within the nxt couple of months - after all theres no reason not to.

Better to not have javascript alter the pages design - just leave js for effects and data checking etc etc. Keep the 'look' of your site to css and you'll have a forwards compatable site that won't break when a new version of the standards compliant browsers are released.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.