Using Javascript in CSS
HTC with IE
body {
behavior:url(script.htc);
}
script.htc
XBL with Firefox
body {
-moz-binding: url(script.xml#mycode);
}
script.xml:
alert("XBL script executed.");
I think what you may be thinking of is expressions or "dynamic properties", which are only supported by IE and let you set a property to the result of a javascript expression. Example:
width:expression(document.body.clientWidth > 800? "800px": "auto" );detail here: http://stackoverflow.com/questions/476276/using-javascript-in-css
Nhận xét
Đăng nhận xét