日期:2014-05-16  浏览次数:20311 次

JavaScript捕获IE窗口的resize事件
这个是打开浮动窗口的主页面
<html>
<head>
<title>main page</title>
<script language="JavaScript">
<!--
function openWin(){
window.open("page.html","newwindow","height=100,width=400,toolbar=no,menubar=no,scrollbars=no,resizable=yes,location=no,status=no");
}
//-->
</script>
</head>
<body>
<a href="#" onClick="openWin();">摄像头1号</a>
</body>
</html>

这个是被调用打开的IE页面,这个页面可以随时调整大小
页面中的PIC也可以由捕获的RESIZE事件来调整大小

<html>
<head>
<title>test for window</title>
<script language="JavaScript">
<!--
var t = function(){
    var pic = document.getElementById("imgPic");
    pic.width=document.body.clientWidth;
    pic.height=document.body.clientHeight;
}
window.onresize = t;//?aê2?′òa′¥·¢2′?£?
//-->
</script>
</head>
<body>
<img src="http://www.onejoo.com/story_media/20070828/Source/5703203F-00D5-4184-AD21-9DE3BD75FEBC.jpg" id="imgPic">
test for pop up windows
</body>
</html>

特别要注意,里面的JPG图片的后缀一定要按照规范写成.jpg小写,不要写成.JPG,那样会导致IE崩溃,我用的是IE7来测试的。不知道
这个问题产生的原因。