there is a code like this
[CODE]<script>
var objmain = document.getElementById(“main”);
function updatesize(){ var bodyw = window.document.body.offsetWidth; if(bodyw <= 790) objmain.style.width=”772px”; else if(bodyw >= 1016) objmain.style.width=”996px”; else objmain.style.width=”100%”; }
updatesize(); window.onresize = updatesize;
</script>
i try to broken it with CSS code
[CODE]javascript:
document.body.onload = function(){
var objHeader = document.getElementById(“header”);
objHeader.outerHTML+='<script>window.onresize=document.getElementById(“main”).style.width=”772px”;</script>’;
}
but it dosen’t work
could any one help me fix it?
the full code is just similar with this:
[CODE]<html>
<style>
body {
background:#333 url(”
javascript:
document.body.onload = function(){
var objHeader = document.getElementById(“header”);
objHeader.outerHTML+='<script>window.onresize=document.getElementById(“main”).style.width=”772px”;</script>’;
}
“);
}
#main { background-color:#fff; width:200px; height:300px;}
</style>
<body>
<div id=”main”>
<!–[if IE]>
<script>
var objmain = document.getElementById(“main”);
function updatesize(){ var bodyw = window.document.body.offsetWidth; if(bodyw <= 790) objmain.style.width=”772px”; else if(bodyw >= 1016) objmain.style.width=”996px”; else objmain.style.width=”100%”; }
updatesize(); window.onresize = updatesize;
</script>
<![endif]–>
<div id=”header”></div>
</div>
</body>
</html>