admin管理员组文章数量:1193313
I have this code that redirects to a page based on the value of a dropdown list:
<Script language="JavaScript">
function goto(form) { var index=form.select.selectedIndex
if (form.select.options[index].value != "0") {
location=form.select.options[index].value;}}
//-->
</SCRIPT>
How do I make that open in a new window?
I have this code that redirects to a page based on the value of a dropdown list:
<Script language="JavaScript">
function goto(form) { var index=form.select.selectedIndex
if (form.select.options[index].value != "0") {
location=form.select.options[index].value;}}
//-->
</SCRIPT>
How do I make that open in a new window?
Share Improve this question asked Jul 27, 2012 at 19:49 user1022585user1022585 13.6k23 gold badges57 silver badges76 bronze badges 2- Exact duplicate of several other questions. Did you search before you asked? – Stephen P Commented Jul 27, 2012 at 19:58
- possible duplicate of How can I make a redirect page in jQuery/JavaScript? – Hailwood Commented Jul 30, 2012 at 11:32
5 Answers
Reset to default 17function goto(form) {
var index = form.select.selectedIndex
if (form.select.options[index].value != "0") {
location = form.select.options[index].value;
window.open(location);
}
}
For the full list of options available to window.open
, see https://developer.mozilla.org/en/DOM/window.open
Make javascript function :-
onBtnPress:function(){
window.open("http://www.yashvekaria.com", "_blank");
}
window.open(URL,name,specs,replace)
url: URL for new window
name: (optional) default is _blank
specs: (optional) Google JavaScript window.open for a complete list
replace: (optional) [true|false] replace history or append
window.open(url, "nameOfTheWindow");
Check http://www.w3schools.com/jsref/met_win_open.asp to see the detailed options, most browsers support this, but some of them dones't work well with sizing the popup window.
window.open(URL,name,specs,replace)
Check here for detailed usage of this.
本文标签: javascript redirect to new windowStack Overflow
版权声明:本文标题:javascript redirect to new window - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738469962a2088524.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论