Ben Nolan's non-link element hovering trick for Internet Explorer (that normally only allows :hover styles on links) is pretty handy, but what really impressed me about it is his way of integrating arbitrary Javascript functions into the stylesheet itself:
body {
background: url("
javascript:
document.body.onload = function(){
...custom js here...
}
");
}By specifying a rule like this in the browser's user stylesheet, it might even be possible to run a custom set of Javascript commands on opening of any visited website. (Although my brief attempt at making this work proved unsuccessful.) [via webgraphics]comments
1. posted by Ruben at 13:26 on January 07, 2004
It is really interesting indead. I already read the discussion thread in the forum of Tweakers.net, see:
http://gathering.tweakers.net/forum/list_messages/831654/last
The interesting part is that it is somehow specified in the W3 specs of CSS2, see:
http://www.w3.org/TR/REC-CSS2/generate.html#content
http://www.w3.org/TR/REC-CSS2/media.html
http://gathering.tweakers.net/forum/list_messages/831654/last
The interesting part is that it is somehow specified in the W3 specs of CSS2, see:
http://www.w3.org/TR/REC-CSS2/generate.html#content
http://www.w3.org/TR/REC-CSS2/media.html
2. posted by Richard Soderberg at 01:01 on January 13, 2004
The spec also specifies that "Generated content does not alter the document tree. In particular, it is not fed back to the document language processor (e.g., for reparsing)".
It seems IE is ignoring this directive, which I think is right.
It seems IE is ignoring this directive, which I think is right.
3. posted by Richard Soderberg at 01:13 on January 13, 2004
IE is right, that is. Not the directive. I think the directive is shor-sighted and limiting -- but in the face of embedding active content in CSS, well, maybe I can see their point of view.
4. posted by bob at 17:51 on May 27, 2006
cool
5. posted by A to Z of World at 10:32 on January 15, 2007
I did try it and indeed is handy. But as expected I'm not finding a situation to put it in real time usage as I rarely need something which works only with IE :)
6. posted by hotmail.com,ddrmax4ever,Derek at 17:48 on January 18, 2008
i cant seem to make it work for the way i thought of. I was trying to embed onmouseover and onmouseout functions to work. Anyone is willing to give me insight?Just send me an email, thank you