首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

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

2012-03-13 
showModalDialog传radio框的值通过window.showModalDialog(popFile,window,winFeatures)传值要从父页面取

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>

热点排行