开发者

How to auto start a a href="javascript:void window.open( open loading

<a h开发者_如何学Goref="javascript:void window.open('website', 'pukarock', 'width=1018, height=715, scrollbars=yes, resizable=yes');">click me</a>

How do you auto start this in HTML as onload? Other stuff I researched doesn't work. I only want my website to open up in a new window and has to work with blogspot.


Put it in a script block, not an A-tag.

<script type='text/javascript'>
window.open('website', 'pukarock', 'width=1018, height=715, scrollbars=yes, resizable=yes')
</script>


Don't use href="javascript:void"

It means people without javascript cannot use the link. Use something like this instead.

<a href="http://www.mysite.com/" onclick="openNewWindow(this.href); return false;">Click</a>

Then add this to the head of your page

<script>
  function openNewWindow(url) {
     window.open(url, 'pukarock', 'width=1018, height=715, scrollbars=yes, resizable=yes')
  }
</script>


If you want open page after load content, use this:

<!--use some standards of html-–>
<html>
<head>
</head>
<body onload="openSite();">
<script type='text/javascript'>
function openSite()
    {
        window.open('website','pukarock','width=1018,height=715,scrollbars=yes,resizable=yes');
    }
</script>
</body> 
</html>

But it could show pop up window warning.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜