javascript- window.open在google chrome和safari中不起作用? [英] javascript- window.open doesn't work in google chrome and safari?

查看:466
本文介绍了javascript- window.open在google chrome和safari中不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨Codians,
我为这项小小的工作陷入了深深的麻烦[似乎].我已经尝试在Google Chrome和Safari中运行window.open,但到目前为止还没有运气.我已经张贴了每个地方,并在这里张贴这是我最后的希望.
我正在尝试使用以下代码.

Hi Codians,
I have been in deep trouble for this tiny work[seems]. I have tried to run the window.open in google chrome and safari, but so far no luck. I have posted every where and posting here this is my last hope.
I am trying to do with the following code.

string script= "window.open('http://www.codeproject.com','_blank','toolbar=yes,status=1,menubar=yes,scrollbars=yes,resizable=no,left=20,top=20,width=600,height=550');";

ScriptManager.RegisterStartupScript(this, this.GetType(), "newWindowScript",  script, true);

推荐答案

尝试一下,希望对您有所帮助.

将此脚本放在aspx页面上:
< script type ="text/javascript">
函数openNew(){
window.open(``http://www.codeproject.com'',``mywindow'',``工具栏=否,位置=否,目录=否,状态=否,菜单栏=否,滚动条=是, copyhistory =是,可调整大小=否,宽度= 600,高度= 550'');
}
</script>

在后台代码上:

Page.ClientScript.RegisterStartupScript(this.GetType(),"mywindow","openNew();",true);
hi try this, hope this will help you.

put this script on your aspx page:
<script type="text/javascript">
function openNew() {
window.open(''http://www.codeproject.com'', ''mywindow'', ''toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,copyhistory=yes,resizable=no,width=600,height=550'');
}
</script>

on code-behind:

Page.ClientScript.RegisterStartupScript(this.GetType(), "mywindow", "openNew();", true);


这篇关于javascript- window.open在google chrome和safari中不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆