弹出对话框的新问题?
在我的页面中,有一个按钮的点击后,弹出对话框。
问题是,我的对话框里面,需要有Radio的新式,还需要有确定按钮,当我点击确定按钮后,会把Radio中的Value取到,并保存到我原来的哪个页面中!
请教高手啊,如何实现啊?
------解决方案--------------------两个页面,1.htm
<input name= "haha " type= "hidden ">
<script language=javascript>
window.showModalDialog( "2.htm ",window)
alert(document.getElementById( "haha ").value)
</script>
2.htm
<input name= "aa " type= "radio " value= "1 "> asdasd
<input name= "aa " type= "radio " value= "2 "> asdasd2
<input name= "haha " type= "button " onclick= "show() ">
<script language=javascript>
function show()
{
var objs=document.getElementsByName( "aa ")
for(var i=0;i <objs.length;i++)
{
if(objs[i].checked)
window.dialogArguments.document.getElementById( "haha ").value=objs[i].value
window.close()
}
}
</script>
------解决方案--------------------window.opener.text1.value = radio1.value;
------解决方案--------------------如果是模态对话框可像1楼那样处理。
同时,如果返回的值比较多,可采取返回Object对象的办法。
如:
var obj = new Object();
obj.param1 = "a ";
obj.param2 = "b ";
window.returnValue = obj;
------解决方案--------------------parent.window.opener.document.all.text1.value = radio1.value
------解决方案--------------------noname1.html
<body id= "www.never-online.net ">
<script type= "text/javascript ">
// <![CDATA[
function FnOpenWindow(sPageUrl) {
var w = window.open(sPageUrl);
}
//]]>
</script>
<button onclick= "FnOpenWindow( 'noname2.html ') "> compare </button>
<table border= "1 " cellpadding= "0 " cellspacing= "0 " width= "100% " id= "tbl ">
</table>
</body>
noname2.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN "
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd ">
<html xmlns= "http://www.w3.org/1999/xhtml ">
<head>
<title> - http://www.never-online.net </title>
<meta http-equiv= "ImageToolbar " content= "no " />
<meta name= "author " content= "never-online, BlueDestiny "/>
<script type= "text/javascript ">
// <![CDATA[
var prefixName = "neverOnline ";
var openerElementId = 'tbl ';
var checkBoxName = "cb ";
function FnGetRow(o) {
while (o.tagName!= "TR ") {
o = o.parentNode;
}; return o;
}
function FnBar(o) {
var oTr = FnGetRow(o);
var $ = window.opener.document.getElementById;
var oTbl = $(openerElementId);
try { var e = $(prefixName+o.value); } catch(ex) {};
if (o.checked) {
if (e) return; else {
var tr = oTbl.insertRow();
tr.id = prefixName+o.value;
for (var i=0; i <oTr.cells.length; i++) {
var td = tr.insertCell(i);