How do I embed Javascript in CSS?
2 answers
In IE, and only in IE, you can use CSS expressions:
width: expression(blah + "px");
Then width
it becomes inside the parenthesis.
This only works in IE, so it doesn't use it . Use JS function to style your elements with element.style.width
or similar.
For example:
<script type="text/javascript">
document.getElementById('header').style.width = (100 * 2) + 'px';
</script>
+7
source to share