<!DOCTYPE html >
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
}
//以下两个方法是用来使在新打开的页面没有被关闭下不得操作原页面
function disableForms()
document.onFocus =disableMe;
document.onKeyDown =disableMe;
document.onKeyPress =disableMe;
document.onKeyUp =disableMe;
document.οnmοusedοwn=disableMe;
document.onmouseup =disableMe;
window.onmousedown =disableMe;
window.onmouseup =disableMe;
}
//如果modalWin 没有被关闭都会获得焦点。
function disableMe()
{
if(modalWin && !modalWin.closed)
{
modalWin.focus();
return false;
}
return true;
}
//一个简单的 window.open例子
function addAttachment(){
var ret = window.open('http://www.baidu.com','newwindow','height=360,width=750,toolbar=yes,menubar=yes,scrollbars=no, resizable=no,location=yes, status=no,left=50');
}
//控制页面10秒后关闭
function closeit()
{
setTimeout("self.close()",10000) //毫秒
}
</script>
</head>
<body>
<a href="javascript:void(0)" οnclick="addAttachment()"> open1</a>
<a href="javascript:void(0)" οnclick="openWindow('newwindow','750','380','http://www.baidu.com')"> open2</a>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script language="javascript">
var winStats;//新建页面参数的变量var modalWin;//用于获得新建页面的对象
//wname:页面的名字,w:页面的宽,h:页面的高,jsp:页面地址
function openWindow(wname,w,h,jsp){
winStats='width='+w+',height='+h+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no';
modalWin = window.open(jsp,wname,winStats);
disableForms();}
//以下两个方法是用来使在新打开的页面没有被关闭下不得操作原页面
function disableForms()
{
//执行以下操作都会触发disableMe函数
self.onFocus =disableMe;document.onFocus =disableMe;
document.onKeyDown =disableMe;
document.onKeyPress =disableMe;
document.onKeyUp =disableMe;
document.οnmοusedοwn=disableMe;
document.onmouseup =disableMe;
window.onmousedown =disableMe;
window.onmouseup =disableMe;
}
//如果modalWin 没有被关闭都会获得焦点。
function disableMe()
{
if(modalWin && !modalWin.closed)
{
modalWin.focus();
return false;
}
return true;
}
//一个简单的 window.open例子
function addAttachment(){
var ret = window.open('http://www.baidu.com','newwindow','height=360,width=750,toolbar=yes,menubar=yes,scrollbars=no, resizable=no,location=yes, status=no,left=50');
}
</script>
//控制页面10秒后关闭
function closeit()
{
setTimeout("self.close()",10000) //毫秒
}
</script>
</head>
<body>
<a href="javascript:void(0)" οnclick="addAttachment()"> open1</a>
<a href="javascript:void(0)" οnclick="openWindow('newwindow','750','380','http://www.baidu.com')"> open2</a>
</body>
</html>