两个页面之间传值
来源:互联网 发布:java 向上取整 int 编辑:程序博客网 时间:2024/05/03 17:16
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
onclick="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=# onclick="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)onclick="window.open(......);"
或者onclick="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
onclick="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=# onclick="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)onclick="window.open(......);"
或者onclick="showModalDialog(filename,window,"status:false;dialogWidth:"+width+"px;dialogHeight:"+height+"px")";区别在于前者可以点击父页面,后者不可以。
2)
对于一的前者
window.opener.document. ......
对于后者
window.dialogArguments.document. ......
- 两个页面之间传值
- 两个页面之间的另一种传值
- OnClientTriggerClick 两个页面之间互相传值
- 两个页面之间的传值提醒
- 在两个html页面之间传值
- 两个html页面之间的传值
- 两个HTML页面之间传值
- Flex中两个Application页面之间的传值
- Flex中两个Application页面之间的传值
- 用js在两个页面之间传值
- .net中两个页面之间传值的方
- 两个页面之间通过js进行传值
- 两个页面之间通过url地址栏进行传值
- 两个页面之间通过js进行传值
- Object-C两个页面viewcontroller 之间的传值方法
- 关于两个html页面之间的传值
- 两个HTML页面之间传值的问题
- 两个html页面之间传参
- PowerDesigner 12+破解
- String path = request.getContextPath(....拼装当前网页的相对路径
- 电脑高手常用的五个按钮
- eclipse操作的一些小技巧 for AIDL实例
- Fedora 15 安装 fusion 以及修改默认打开方式
- 两个页面之间传值
- 为WPF和Silverlight的Grid添加边框线
- Map-Reduce简介
- Maven的基本原理和新特性
- Android 实现书籍翻页效果----源码篇
- Android游戏之神农诀项目开发 即将全面上线,敬请关注!
- js容易混淆或忘记的知识小总结(一)
- MYSQL:The server quit without updating PID file
- Open Inventor练习-一维拖拽器SoTranslate1Dragger