how to resize a div as soon as the document is loaded
i am trying to do this in javascript:
var w = 1280;
var h = 1024;
window.onload = function()
{
if (w > 0)
document.getElementById('flashdiv').style.width=w;
else
document.getElementById('flashdiv').style.width="100%";
alert(document.getElementById('flashdiv').style.width);
if (h > 0)
document.getElementById('flashdiv').style.height=h;
else
document.getElementById('flashdiv').style.height="100%";
};开发者_如何转开发
but it doesnt seem to resize the div at all. what am i missing here?
style.width is a string so you have to do
document.getElementById('flashdiv').style.width=w+"px";
精彩评论