开发者

to open a page in new tab using self.location?

开发者 https://www.devze.com 2023-01-30 01:29 出处:网络
I am using self.location=\"www.google.com\";开发者_运维知识库 in my code to open google page. How can i open same page in another window.You can use the window object\'s open method like so:

I am using self.location="www.google.com";开发者_运维知识库 in my code to open google page. How can i open same page in another window.


You can use the window object's open method like so:

window.open("www.google.com");


You can use an <a> tag and set the target="_blank" property to open a page in anew tab/window. Whether this will be opened in a new tab/windows depends entirely on the settings in the user agent.

<a href="http://www.google.com" target="_blank">Google</a>


try this

window.open ("www.google.com","mywindow");


<script>
function fullwin(targeturl) {
window.open(targeturl,"","fullscreen,scrollbars")
}
</script>

<form>
<input type="button" onClick="fullwin('mypage.html')" value="Show My Frameset">
</form>


i see at least one freaky method:

<a id='newwnd' href='goole.com' style='display:hidden' target='blank'></a>
...
document.getElementById('newwnd').click();
0

精彩评论

暂无评论...
验证码 换一张
取 消