/    Sign up×
Community /Pin to ProfileBookmark

hack the width

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>[/CODE]

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>’;
}[/CODE]

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>[/CODE]

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @dotku spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...