如何在两个页面中传递两个参数? 在线等待 急急急急急急急急急急急!!!!

bluesky_ql 2002-10-30 02:50:05
如何在两个页面中传递两个参数?


test1.htm 中有两个 textbox: code1 code2

如何把 test2.htm 中的的两个参数传递回 test1.htm 赋给 code1 code2 ???





test1.htm

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script lauguage=javascript>

function selecthy(ctrlobj,ctrlobj2) {
newWINwidth = 210 + 4 + 18;
retval = window.showModalDialog("test2.htm", "", "dialogWidth:400px; dialogHeight:430px; dialogLeft:100px; dialogTop:0px; status:no; directories:yes;scrollbars:no;Resizable=no; " );
if( retval != null ) {
ctrlobj.value = retval;
ctrlobj2.value = retval;
}
}

</script>
</head>

<body bgcolor="#FFFFFF" text="#000000">
<form name="form1" method="post" action="">
<input type="text" name="code1" readonly=true >
<input type="text" name="code2" onclick='selecthy(code1,code2);return false' readonly=true >
</form>
</body>
</html>



test2.htm

function getbm(code1,code2){
parent.window.returnValue = code1;
parent.window.returnValue = code2; ?????
parent.window.close();
}


<td width="25%" onmouseover=mOvr(this,'') onmouseout=mOut(this,'') onclick=getbm("code1","code2")></td>

...全文
43 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
emu 2002-10-30
  • 打赏
  • 举报
回复
呵呵,可要小心挑一个用户不大会输入的分隔符。
flylyke 2002-10-30
  • 打赏
  • 举报
回复
test1.htm:
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script lauguage=javascript>
function test2V(){
var col;
var row
var adr = showModalDialog("test2.htm", "", "dialogWidth:18.5em; dialogHeight:11.5em; status:0");
if(adr!=null){
var ss;
ss=adr.split(",");
col=ss[0];
row=ss[1];
a.value=col
b.value=row;
}}
</script>
<input id="a"><input id="b"><input type=button name="button" onclick="test2V()">
</html>

test2.htm
<html>
<script>
function ret(){
window.returnValue=code1.value+","+code2.value
}
</script>
<input name="code1">
<input name="code2">
<input type=button onclick="ret();window.close()">
</html>
lbd8848 2002-10-30
  • 打赏
  • 举报
回复
你可以
tmpcode:=code1 + '分格符' + code2;
window.returnValue=tmpcode;
再在test1.htm页面中取出code1和code2
emu 2002-10-30
  • 打赏
  • 举报
回复
function getbm(code1,code2){
returnValue=[code1,code2];
close();
}

------------------------
ctrlobj.value = retval[0]
ctrlobj2.value = retval[1]
flylyke 2002-10-30
  • 打赏
  • 举报
回复
可以用window.returnValue=[Value]把test2的值返回

87,996

社区成员

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

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