showModalDialog()方法中传入window参数
来源:互联网 发布:淘宝论坛网址 编辑:程序博客网 时间:2024/06/14 11:15
在父窗口中,假如我们是在服务器控件中调用javascript代码的,你可以这样写:
Page.ClientScript.RegisterStartupScript(this.GetType(), "test", "window.showModalDialog('Default4.aspx',window)", true);
Default4.aspx就是子窗口的页面。这里要注意不能使用Page.ClientScript.RegisterClientScriptBlock()因为Block方法会把该script脚本写在所有控件的前面,这样在页面被加载时,TextBox1控件还没有被加载,子窗口就打开了,所以在子窗口时取不到任何控件的值的。而RegisterStartupScript()方法正好相反,他是把对应Script脚本写在所有控件的后面,所以子窗口能够得到父窗口的任何控件的值。
如果你是在客户端写的JavaScript脚本,那就更简单了
<script language="javascript">
function popwindow()
...{
window.showModalDialog('Default4.aspx',window);
}
</script>
在子窗口中可写入如下脚本:
<script language="javascript">
var vwin = window.dialogArguments; //得到window参数
var doc = vwin.document.getElementById("TextBox1").value; //获得TextBox的值
alert(doc);
</script>
- showModalDialog()方法中传入window参数
- 中文作为参数传入 window.showModalDialog出现乱码的解决办法
- 中文作为参数传入 window.showModalDialog出现乱码的解决方法
- window.showModalDialog参数传递
- window.showModalDialog()方法介绍
- window.showModalDialog 参数传递中含有特殊字符的处理
- Window.ShowModalDialog的参数问题
- window.showModalDialog()如何传递参数
- Window.ShowModalDialog的参数问题
- Window.ShowModalDialog的参数问题
- java方法中传入(Object... strs)参数
- Window.Open() 和 window.showModalDialog()参数
- Window.Open() 和 window.showModalDialog()参数
- window.showModalDialog 与window.open传递参数
- window.open 参数 和 showModalDialog() 和 window.showModalDialog()
- javascript中的window.showModalDialog()方法
- HTML中window.open、window.showModalDialog的使用方法以及参数说明
- window.open()代替window.showModalDialog()的方法
- 分析Windows和Linux动态库
- 标准C++实现C#代理机制
- SQO2008配置管理工具服务显示远程过程调用失败 0x800706be
- vim环境创建for python
- Android R文件不能同步更新
- showModalDialog()方法中传入window参数
- Ubuntu启动后自动加载ext4分区
- JDBC连接postgresql
- 数据结构与算法[LeetCode]——sqrt(x)
- Thumbnailator java图片压缩,加水印,批量生成缩略图
- android WebView 使用实例
- eclipse安装SVN插件的两种方法
- JAVA NIO non-blocking模式实现高并发服务器
- JS验证