Google不兼容ShowModalDialog()弹出对话框的解决办法
2024-09-01 14:02:46
<script type="text/javascript">
//弹窗函数
function openDialog() {
var url = "https://www.xxxx.com/UI/Test.aspx?uid=111&Userid=luke";
//调用实例
var modalReturnValue = myShowModalDialog(url, window, 450, 500);
//alert(modalReturnValue.name);
}
//弹出框google Chrome执行的是open
function myShowModalDialog(url, args, width, height) {
var tempReturnValue;
if (navigator.userAgent.indexOf("Chrome") > 0) {
var paramsChrome = 'height=' + height + ', width=' + width + ', top=' + (((window.screen.height - height) / 2) - 50) +
',left=' + ((window.screen.width - width) / 2) + ',toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no';
window.open(url, "newwindow", paramsChrome);
}
else {
var params = 'dialogWidth:' + width + 'px;dialogHeight:' + height + 'px;status:no;dialogLeft:'
+ ((window.screen.width - width) / 2) + 'px;dialogTop:' + (((window.screen.height - height) / 2) - 50) + 'px;';
tempReturnValue = window.showModalDialog(url, args, params);
}
return tempReturnValue;
}
</script>
返回值写法
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
Response.Write("<script>window.returnValue = '返回值OK'; </script> ");
}
}
最新文章
- css屏蔽元素的鼠标事件pointer-events
- 《zw版&#183;Halcon-delphi系列原创教程》 Halcon分类函数012,polygon,多边形
- 通过使用ScriptManager.RegisterStartupScript,呈现后台多次使用alert方法
- Yii中Ajax的使用,如收藏功能
- SPFA_YZOI 1662: Easy sssp
- 创建android 模拟器并在cmd中打开
- iOS tableView移除某一行的分割线 让分割线宽度为整个cell的宽度
- angularui 分页
- python struct.pack() 二进制文件,文件中打包二进制数据的存储与解析
- CountDownLatch、CyclicBarrier和Semaphore基本原理和使用
- System.Data.Entity.Infrastructure.DbUpdateException
- Java 反射 调用私有构造方法
- Linux免密码登录设置 &;&; 设置快捷键
- TransmittableThreadLocal 解决 线程池线程复用 无法复制 InheritableThreadLocal 的问题.
- #python str.format 方法被用于字符串的格式化输出。
- 有效单词词广场——算法面试刷题5(for google),考察数学
- 查找文件路径find
- 第1章 MATLAB概述
- Gym - 101572G Galactic Collegiate Programming Contest 小根堆(set)
- [Xcode 实际操作]三、视图控制器-(4)使用UINavigationController导航栏和工具栏