当前位置: 代码迷 >> Java Web开发 >> showModalDialog传radio框的值,该如何处理
  详细解决方案

showModalDialog传radio框的值,该如何处理

热度:107   发布时间:2016-04-17 13:43:00.0
showModalDialog传radio框的值
通过window.showModalDialog(popFile,   window,   winFeatures);传值

要从父页面取得一组radio框中当前所选的值。
window.dialogArguments.Form1.radio1.checked.value这样取值好像不行

------解决方案--------------------
要先循环判断哪个RADIO被选中了,然后再传值document.form1.radio1[i].value,判断用if (document.form1.radio1[i].checked),i为下标
------解决方案--------------------
[parent]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN ">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME= "Generator " CONTENT= "EditPlus ">
<META NAME= "Author " CONTENT= " ">
<META NAME= "Keywords " CONTENT= " ">
<META NAME= "Description " CONTENT= " ">
<script>
function show()
{
var array = new Array();
var r1=document.getElementById( "1 ");
var r2=document.getElementById( "2 ");
array[0]=r1.value;
array[1]=r2.value;
window.showModalDialog( "child.html ",array);
}
</script>
</HEAD>

<BODY onload= "show(); ">
<input name= "1 " type= "radio " id= "1 " >
<input name= "1 " type= "radio " id= "2 " >
</BODY>
</HTML>
[child]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN ">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME= "Generator " CONTENT= "EditPlus ">
<META NAME= "Author " CONTENT= " ">
<META NAME= "Keywords " CONTENT= " ">
<META NAME= "Description " CONTENT= " ">
<script>
var a = window.dialogArguments;
function show()
{
alert(a[0]);
alert(a[1]);
}
</script>
</HEAD>

<BODY onload= "show(); ">

</BODY>
</HTML>
  相关解决方案