我想显示网页作为一个模式弹出。
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>");同时使用上面的代码。我可以显示网页作为模式弹出,但问题是,它也打开了第三个窗口,这是一个网页的同名,而不是一个模式弹出。
请帮我解决这个问题。提前谢谢。
发布于 2014-03-24 12:16:11
与其将脚本写到响应中,不如使用RegisterStartupScript:
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>");https://stackoverflow.com/questions/22607386
复制相似问题