新手提问showModalDialog传值问题
我现有个页面1.aspx就一个客户端按钮执行函数
function showwindow()
{
var str= window.showModalDialog( 'frame.htm ', 'window ', 'dialogHeight: 550px; dialogWidth: 766px; center: Yes; help: No; resizable: Yes; status: No; ');
window.location.href=window.location.href;
alert(str);
}
frame.htm是个框架页面,里面有
<frameset cols= "300,* ">
<frame id= "left " src= "Default.aspx ">
<frame id= "right " src= "HTMLPage.htm ">
</frameset>
两个框架,HTMLPage.htm上有个文本框a.text。在当我点击HTMLPage.htm上的按钮的时候我想把a.text的值传到1.aspx并且刷新该页面
------解决方案--------------------3个页面
<input name= "haha ">
<script language=javascript>
function showwindow()
{
var str= window.showModalDialog( '3.htm ', 'window ', 'dialogHeight: 550px; dialogWidth: 766px; center: Yes; help: No; resizable: Yes; status: No; ');
alert(str);
document.getElementById( "haha ").value=str
}
showwindow();
</script>
3.htm
<frameset cols= "300,* ">
<frame id= "left " src= "4.htm ">
<frame id= "right " src= "1.htm ">
</frameset>
4.htm
<script language=javascript>
function closeWindow()
{
parent.window.returnValue= "asdasdads "
parent.window.close();
}
</script>
<input name= "button1 " type= "button " value= "按 " onclick= "closeWindow(); ">
------解决方案--------------------以前处理过
function add_open(a)
{
var ob=window.showModalDialog( "add_admin.php ",window, "dialogTop:500px;dialogLeft:300px;dialogHeight:350px;dialogWidth:700px;help:0;status:0 ");
document.getElementById(a).value=ob;
}
function init(inType)
{
switch(inType)
{
case 'meeting ':
outHour= 'meeting_time_hour_start ';
outDate= 'meeting_date_start ';
break;
case 'memo ':
outHour= 'memo_time_hour_start ';
outDate= 'memo_date_start ';
break;
}
var ob_hour=document.getElementById(outHour);
var ob_date=document.getElementById(outDate);
ob_date.value=window.dialogArguments.document.getElementById( 'hideTime ').value.substring(0,10);
h=window.dialogArguments.document.getElementById( 'hideTime ').value.substring(10,12);
for(i=0;i <ob_hour.length;i++)
{
if(ob_hour.options[i].value==h)ob_hour.options[i].selected=true;
}
}
function sendback(a)
{
window.retrunValue=a;
}
基本上就是通过returnValue和window.dialogArguments这2个东东来获取
中间可能需要有iframe来中转