<html>
<head>
<meta name="GENERATOR" content="Microsoft Visual Studio 6.0">
<title></title>
<script type="text/javascript" language="javascript">
function openModal() {
popupDialog('child.html', screen.width, screen.height);
}
function showMsg(obj) {
alert(obj);
}
function popupDialog(url, width, height) {
var x = parseInt(screen.width / 2.0) - (width / 2.0);
var y = parseInt(screen.height / 2.0) - (height / 2.0);
var isMSIE = (navigator.appName == "Microsoft Internet Explorer"); //判断浏览器
if (isMSIE) {
retval = window.showModalDialog(url, window, "dialogWidth:" + width + "px; dialogHeight:" + height + "px; dialogLeft:" + x + "px; dialogTop:" + y + "px; status:no; directories:yes;scrollbars:no;Resizable=no; fullscreen=yes;");
}
else {
var win = window.open(url, "mcePopup", "top=" + y + ",left=" + x + ",scrollbars=" + scrollbars + ",dialog=yes,modal=yes,width=" + width + ",height=" + height + ",resizable=no,fullscreen=yes");
eval('try { win.resizeTo(width, height); } catch(e) { }');
win.focus();
}
}
</script>
</head>
<body>
<br>
这是模态窗口的例子测试,在IE下是模态,在FF下不是,作了最大的努力来实现通用,这是父窗口<br>
<input id="button2" type="button" value="按钮,IE,FF通用" onclick="openModal();"><br />
</body>
</html>