When the code is in the page, it works well, but when I remove it from it and place it into an external file it still works in IE6 but not in IE7 my script is very simple, is it something wrong with it? link in the head section <script type="text/javascript" src="xx.js"></script> content of xx.js function AlignContentDiv() { var nScrWidth = screen.width; var nGutterWidth = Math.floor((((nScrWidth-968)/2)*100)/nScrWidth); if (nGutterWidth>3) { nGutterWidth -=1; } elem = document.getElementById("gutterdiv"); elem.style.width = nGutterWidth+"%"; } function reloadPage() { window.location.reload(); }