接受数据tt.html代码:
<html>
<head>
<script language=javascript>
function selectPerson(username_txt)
{
var indexes = window.showModalDialog("rr.html",form1,"dialogHeight:300px;dialogWidth:400px;help:no") + "";
if (indexes!="undefined"){
// alert("indexes = " + indexes);
username_txt.value = form1.username.value ;
}
}
</script>
</head>
<body>
<form name="form1" method="post">
<input name="username" readonly ><a onclick="javascript:selectPerson(form1.username);" style="cursor: hand; color: #000000"><INPUT type="button" value="接受" name="btn1">
</form>
</body>
</html>
发送数据rr.html代码
<html>
<head>
<script language=javascript>
function returnResult(){
if(form2.username.value==""){
alert("null");
}else{
form1 = window.dialogArguments;
form1.username.value = form2.username.value;
window.close();
}
}
</script>
</head>
<body>
<form name="form2" method="post">
<input name="username" value="derek">
<input type="button" value="发送" onclick="returnResult()">
</form>
</body>
</html>