关于两个页面之间传值,和打开新的页面的问题。急用!解决问题马上给分!!!

AHUA1001 2004-07-13 02:36:38
我要问的问题分两个细节:
1、在A页面上,点击某一处(一般是某个按钮或者是某个图片),在不关闭A页面的情况下,打开B页面。最好可以控制B页面显示的大小。
2、在上一个问题解决的基础上,点击B页面的某一处,关闭B页面,在A页面的某个控件(一般是文本框)显示某个值。就是在B页面中选定某个值,然后将该值显示在A页面的相应控件中。
以上两个问题最后能有例子。
急用!解决问题马上给分!!!
...全文
282 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
moving_xm 2004-08-22
  • 打赏
  • 举报
回复
1)onclick="window.open(......);"
或者onclick="showModalDialog(filename,window,"status:false;dialogWidth:"+width+"px;dialogHeight:"+height+"px")";区别在于前者可以点击父页面,后者不可以。
2)
对于一的前者
window.opener.document. ......
对于后者
dialogArguments.document. ......

改成showModalDialog出错,谁能改一下呀
chi8 2004-07-29
  • 打赏
  • 举报
回复
谢谢spiritsl,你的方法我得44
AHUA1001 2004-07-13
  • 打赏
  • 举报
回复
感谢楼上几位高人捧场,特别是jeoky(jeoky),他提供的代码最完整,而且完全可用。
spiritsl 2004-07-13
  • 打赏
  • 举报
回复
1)onclick="window.open(......);"
或者onclick="showModalDialog(filename,window,"status:false;dialogWidth:"+width+"px;dialogHeight:"+height+"px")";区别在于前者可以点击父页面,后者不可以。
2)
对于一的前者
window.opener.document. ......
对于后者
dialogArguments.document. ......
haroyy 2004-07-13
  • 打赏
  • 举报
回复
<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>
yangwlqi 2004-07-13
  • 打赏
  • 举报
回复
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>
AHUA1001 2004-07-13
  • 打赏
  • 举报
回复
frame是不是只能把两个页面放在一个框架中啊?
jeoky 2004-07-13
  • 打赏
  • 举报
回复
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>
ecaol 2004-07-13
  • 打赏
  • 举报
回复
UP
rainworm 2004-07-13
  • 打赏
  • 举报
回复
用frame框架结构试试

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧