將下面代碼保存為index.asp
<form name=fatherform>
<%
for i=1 to 10
%>
收件人:<input type=text name=shoujianren<%=i%> /> 紙條類型<input readonly=readonly type=text name=zhitiao<%=i%> value=默認(rèn) onclick=aaa(this.name,this.value)/><br />
<%
next
%>
</form>
<script>
function aaa(canshu,xuanze)
{
//alert(canshu);
window.open (2.asp?canshu=+canshu+&xuanze=+xuanze, newwindow, height=100, width=400, top=300, left=250, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, status=no)
}
</script>
將下面代碼保存為2.asp
<title>請選擇</title>
<%
dim canshu,xuanze
canshu=request.querystring(canshu)
xuanze=request.querystring(xuanze)
%>
<form name=childform>
<input type=radio name=bbb value=默認(rèn) <%if xuanze=默認(rèn) then response.write checked%> >默認(rèn)
<input type=radio name=bbb value=高興 <%if xuanze=高興 then response.write checked%> >高興
<input type=radio name=bbb value=黯然銷魂 <%if xuanze=黯然銷魂 then response.write checked%>/>黯然銷魂
<input type=button onclick=check(); value=確定>
</form>
<script language=javascript>
function check()
{
var num;
var flag=false;
num=document.childform.bbb.length;
for (j=0;j<num;j++)
{ if(document.childform.bbb[j].checked)
{flag=true;
window.opener.document.fatherform.<%=canshu%>.value=document.childform.bbb[j].value;
window.close();
}
}
if(!flag)
{
alert(沒有選擇!);
window.close();
}
}
</script>
運(yùn)行試試
更多信息請查看IT技術(shù)專欄