简体   繁体   中英

Why doesn't this JavaScript run in Firefox?

It certainly runs on IE6.

Why doesn't this JavaScript run in Mozilla Firefox?

<html>
<head>
 <title>JavaScript Popup Example 3</title>
</head>
<SCRIPT language="JavaScript1.2">
function MyClass()
{
    this.OpenWindow = function()
    {
        var r = window.open ('', 'mywindow', 'location=1,status=1,scrollbars=1,width=100,height=100');
        r.moveTo(0,0);
        r.location.href = 'http://www.google.com';
    }

}
</SCRIPT>
<body onload="javascript: new MyClass().OpenWindow()">
<H1>JavaScript Popup Example 3</H1>
</body>
</html>

It runs just fine in my FF. For me the popup blocker is catching it.

Did you notice that little bar just below the tabs selection

alt text http://support.mozilla.com/img/wiki_up/86c0e1094489ddd5611008de57d0afed-1249166734-294-5.png

Check here for more information + images: FF Pop-up blocker

弹出阻止程序设置

Just go to the FF menu -> option -> content -> block-pop-up-windows

Uncheck the option, click OK and try reload the page. It should now work fine for you. Also, don't forget to tick the check box again if you worry about security.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM