js 里面代码是对的就是不显示!!!

<!DOCTYPE html>







主页面


<br> var newWin;<br> window.onload = function (){<br> newWin = window.open(&quot;<a href="http://www.baidu.com">http://www.baidu.com</a>&quot;, &quot;baidu&quot;, height = 500, width = 800, left = 20, top = 30, tollbal = yes, scrollbars = yes, location = yes, status = yes, menubar = yes, resizable = yes, titlebar = yes);<br> }<br>
关闭广告

不是用户交互点击的弹出窗口都会被浏览器拦截,改为为点击打开才能用window.open,而且open第三发个参数用引号括起,而不是溜过来


        var newWin;
        window.onload=function () {
            document.onclick=function () {
                newWin=window.open("http://www.baidu.com","baidu",'height=500,width=800,left=20,top=30,tollbal=yes,scrollbars=yes,location=yes,status=yes,menubar=yes,resizable=yes,titlebar=yes');
            }
        }

关闭操作要判断newWin变量是有值后在再调用方法,要不报错

 <a href="javascript:newWin&&newWin.close()">关闭广告</a>