:: Forum >>

style in div tag

I have a phrase code:

<script language=javascript>
function setStyle(){
var i=300;
test.style.overflow="scroll";
test.style.background='red';
test.style.height=i;
}
</script>
<body onload=setStyle()>
<div id="test" >
aaa
bbb
</div>
</body>

But it is not working. Can you help me to make it run? Thank you very much.
Friday, April 29, 2005
Okay... I'm not the ActiveWidgets forum police, but I think everyone here would prefer to keep this forum specific to ActiveWidgets questions... which your post has nothing to do with.

However, what's not working about it... and what browser are you using to test it with?

It works fine on IE 6.
brians
Friday, April 29, 2005
Put this in the function instead.

var i = 300;
elem = document.getElementById('test').style;
elem.overflow = 'scroll';
elem.background = 'red';
elem.height = i + 'px';
mjac
Thursday, June 2, 2005

This topic is archived.


Back to support forum

Forum search