首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ShowModalDialog面临的问题

ShowModalDialog面临的问题
EN

Stack Overflow用户
提问于 2014-03-24 10:55:20
回答 1查看 416关注 0票数 1

我想显示网页作为一个模式弹出。

代码语言:javascript
复制
Response.Write("<script type='text/javascript'>detailedresults=window.showModalDialog('NewFile.aspx','Data','left=(screen.width) ? (screen.width - 800) / 2 : 0,top=(screen.height) ? (screen.height - 700) / 2 : 0,width=1000,  height=500, toolbar=no, menubar=no, titlebar=no, location=no, addressbar=no');</script>");

同时使用上面的代码。我可以显示网页作为模式弹出,但问题是,它也打开了第三个窗口,这是一个网页的同名,而不是一个模式弹出。

请帮我解决这个问题。提前谢谢。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-03-24 12:16:11

与其将脚本写到响应中,不如使用RegisterStartupScript

代码语言:javascript
复制
Page.ClientScript.RegisterStartupScript(this.GetType(),
                "detailedresults",
                "<script type='text/javascript'>detailedresults=window.showModalDialog('NewFile.aspx','Data','left=(screen.width) ? (screen.width - 800) / 2 : 0,top=(screen.height) ? (screen.height - 700) / 2 : 0,width=1000,  height=500, toolbar=no, menubar=no, titlebar=no, location=no, addressbar=no');</script>");
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/22607386

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档