a.htm
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
</head>
<body>
<form name="form1" method="post" action="">
<table width="400" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="94"> </td>
<td width="306"> </td>
</tr>
<tr>
<td> </td>
<td><input name="text" type="text" id="text"></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><input name="Submit" type="button" onClick="MM_openBrWindow('/b.htm','','scrollbars=yes,width=300,height=400')" value="打开新窗口"></td>
</tr>
</table>
</form>
</body>
</html>
b.htm
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<script>
function returnText() {
window.opener.form1.text.value=form1.text.value;
window.close();
}
</script>
<body>
<table width="100%" height="300" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center"><form name="form1" method="post" action="">
<input name="text" type="text" id="text" value="请输入你的内容">
<br>
<input type="button" name="Submit" value="关 闭" onClick="returnText()">
</form>
</td>
</tr>
</table>
</body>
</html>
---------------------------------------------------------------
a中用onclick事件打开b
οnclick="javascript:window.open('b','','toolbar,resizable,scrollbars=auto,dependent,width=400,height=280');"
点击B页面的某一处触发javascript事件
<script language="javascript">
<!--
function check()
{
window.opener.document.form1.roomID.value=form1.roomID.value;
window.close();
}
</script>
---------------------------------------------------------------
<a href=# οnclick="window.open ('AddUser.aspx', 'newwindow', 'height=280, width=320, top=150, left=300, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=n o, status=no')">new window</a>
---------------------------------------------------------------
1)οnclick="window.open(......);"
或者οnclick="showModalDialog(filename,window,"status:false;dialogWidth:"+width+"px;dialogHeight:"+height+"px")";区别在于前者可以点击父页面,后者不可以。
2)
对于一的前者
window.opener.document. ......
对于后者
window.dialogArguments.document. ......
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
</head>
<body>
<form name="form1" method="post" action="">
<table width="400" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="94"> </td>
<td width="306"> </td>
</tr>
<tr>
<td> </td>
<td><input name="text" type="text" id="text"></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td><input name="Submit" type="button" onClick="MM_openBrWindow('/b.htm','','scrollbars=yes,width=300,height=400')" value="打开新窗口"></td>
</tr>
</table>
</form>
</body>
</html>
b.htm
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<script>
function returnText() {
window.opener.form1.text.value=form1.text.value;
window.close();
}
</script>
<body>
<table width="100%" height="300" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="center"><form name="form1" method="post" action="">
<input name="text" type="text" id="text" value="请输入你的内容">
<br>
<input type="button" name="Submit" value="关 闭" onClick="returnText()">
</form>
</td>
</tr>
</table>
</body>
</html>
---------------------------------------------------------------
a中用onclick事件打开b
οnclick="javascript:window.open('b','','toolbar,resizable,scrollbars=auto,dependent,width=400,height=280');"
点击B页面的某一处触发javascript事件
<script language="javascript">
<!--
function check()
{
window.opener.document.form1.roomID.value=form1.roomID.value;
window.close();
}
</script>
---------------------------------------------------------------
<a href=# οnclick="window.open ('AddUser.aspx', 'newwindow', 'height=280, width=320, top=150, left=300, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=n o, status=no')">new window</a>
---------------------------------------------------------------
1)οnclick="window.open(......);"
或者οnclick="showModalDialog(filename,window,"status:false;dialogWidth:"+width+"px;dialogHeight:"+height+"px")";区别在于前者可以点击父页面,后者不可以。
2)
对于一的前者
window.opener.document. ......
对于后者
window.dialogArguments.document. ......