首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > VB Dotnet >

window.showModalDialog 回传值的有关问题

2012-01-16 
window.showModalDialog 回传值的问题dimaaasstringaa scriptaa+ varsrcFilerqxz.aspx 选择日

window.showModalDialog 回传值的问题
dim   aa   as   string
aa= " <script> "
aa+= "var   srcFile   =   'rqxz.aspx '; "       '选择日期的网页
aa+= "var   winFeatures   =   "dialogHeight:   550px;   dialogWidth:   800px;center:   Yes;status:   no;scroll:Yes;resizable:no;edge:   Raised; "; "
aa+= "var   b   =window.showModalDialog(srcFile,   ' ',   winFeatures); "
aa+= " </script> "
怎么把window.showModalDialog的回传值赋给本页面的一个text(比如说名字叫text1吧),   也就是说怎么把var   b的值赋给text1,用document.form1.text1.value=b
怎么不行呢?

[解决办法]
1.html
<script type= "text/javascript ">
function btnOpen_Click()
{
//document.MainForm.txtValue.value = window.open( "2.html ", null, "height=300,width=300,status=no,toolbar=no,menubar=no,location=no ");
document.MainForm.txtValue.value = window.showModalDialog( "2.html ");
}
</script>
<form name = "MainForm ">
<input type = "button " value= "Click " name = "btnOpen " onClick= "btnOpen_Click(); " />
<input type = "text " name = "txtValue " />
</form>


2.html
<script type= "text/javascript ">
function btnOpen_Click()
{
window.returnValue = document.Form1.txtValue.value;
alert (document.Form1.txtValue.value);
window.close();
}
</script>
<form name = "Form1 ">
<input type = "button " value= "Click " name = "btnOpen " onClick= "btnOpen_Click(); " />
<input type = "text " name = "txtValue " />
</form>

热点排行