网站制作学习网JS脚本→正文:返回父窗口并传回数据
字体:

返回父窗口并传回数据

JS脚本 2008/10/20 14:08:37  点击:不统计

关键词:父窗口,返回数据,点击弹出窗口确定,返回数据

将下面代码保存为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="默认" 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="默认" <%if xuanze="默认" then response.Write "checked"%> >默认

<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>



运行试试

·上一篇:判断radio选中 >>    ·下一篇:特效的分格广告代码 >>
推荐文章
最新文章