Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/375.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何在浮动层上打开新网站关闭按钮_Javascript_Html - Fatal编程技术网

Javascript 如何在浮动层上打开新网站关闭按钮

Javascript 如何在浮动层上打开新网站关闭按钮,javascript,html,Javascript,Html,我正试图打开一个新的浏览器窗口,这时一个访问者在我的浮动层广告上点击关闭“x” “X”关闭按钮位于html链接代码“a href”的内部,但是在其中添加url不起作用 <script language="JavaScript1.2"> <!-- isIE=document.all; isNN=!document.all&&document.getElementById; isN4=document.layers;

我正试图打开一个新的浏览器窗口,这时一个访问者在我的浮动层广告上点击关闭“x”

“X”关闭按钮位于html链接代码“a href”的内部,但是在其中添加url不起作用

    <script language="JavaScript1.2">
    <!--
    isIE=document.all;
    isNN=!document.all&&document.getElementById;
    isN4=document.layers;
    isActive=false;

    function MoveInit(e){
      topOne=isIE ? "BODY" : "HTML";
      whichOne=isIE ? document.all.FloatingLayer : document.getElementById("FloatingLayer");  
      ActiveOne=isIE ? event.srcElement : e.target;  
      while (ActiveOne.id!="titleBar"&&ActiveOne.tagName!=topOne){
        ActiveOne=isIE ? ActiveOne.parentElement : ActiveOne.parentNode;
      }  
      if (ActiveOne.id=="titleBar"){
        offsetx=isIE ? event.clientX : e.clientX;
        offsety=isIE ? event.clientY : e.clientY;
        nowX=parseInt(whichOne.style.left);
        nowY=parseInt(whichOne.style.top);
        MoveEnabled=true;
        document.onmousemove=Move;
      }
    }

    function Move(e){
      if (!MoveEnabled) return;
      whichOne.style.left=isIE ? nowX+event.clientX-offsetx : nowX+e.clientX-offsetx; 
      whichOne.style.top=isIE ? nowY+event.clientY-offsety : nowY+e.clientY-offsety;
      return false;  
    }

    function MoveN4(whatOne){
      if (!isN4) return;
      N4=eval(whatOne);
      N4.captureEvents(Event.MOUSEDOWN|Event.MOUSEUP);
      N4.onmousedown=function(e){
        N4.captureEvents(Event.MOUSEMOVE);
        N4x=e.x;
        N4y=e.y;
      }
      N4.onmousemove=function(e){
        if (isActive){
          N4.moveBy(e.x-N4x,e.y-N4y);
          return false;
        }
      }
      N4.onmouseup=function(){
        N4.releaseEvents(Event.MOUSEMOVE);
      }
    }

    function ToggleFloatingLayer(DivID, iState) // 1 visible, 0 hidden
    {
        if(document.layers)    //NN4+
        {
           document.layers[DivID].visibility = iState ? "show" : "hide";
        }
        else if(document.getElementById)      //gecko(NN6) + IE 5+
        {
            var obj = document.getElementById(DivID);
            obj.style.visibility = iState ? "visible" : "hidden";
        }
        else if(document.all)   // IE 4
        {
            document.all[DivID].style.visibility = iState ? "visible" : "hidden";
        }
    }

    document.onmousedown=MoveInit;
    document.onmouseup=Function("MoveEnabled=false");
    // -->
    </script>



    <!-- Start Floating Layer -->
    <div id="FloatingLayer" style="position:absolute;width:310px;left:210px;top:230px;visibility:visible;">
        <div id="titleBar" style="cursor:move; width:100%; position:relative; border-bottom:solid 1px #e79300; background-color:#e79300;">
            <div id="title" align="center" style="margin-top:3px;">
                <font size="3" face="Arial" color="#000">Title Here</font>
            </div>
            <div id="closeX" style="cursor:hand; position:absolute; right:5px; top:0px;">
                <a href="#" onClick="ToggleFloatingLayer('FloatingLayer',0);return false"  style="text-decoration:none"><font color="#333333" size="3" face="arial">X</font></a>
            </div>
        </div>
        <div id="floatingContent" align="center" style="padding:3px; background-color:#000; color:#333333;">

HTML GOES HERE

            <!-- End of content area -->
        </div>
    </div>
<!-- End Floating layer -->

标题在这里
这里是HTML

您是否尝试过使用带有链接的新窗口作为目标?
language=“Javascript1.2”
?为什么?请展开并解释链接中的内容。