不了解楼主的代码window.open('超级连接','','')

解决方案 »

  1.   

    try this
    -----------------------------------------------------------------------------
    <input type="checkbox" name="newWindow" onclick="NewWindow(this);">打开新窗口<a href="http://mail.163.com">163邮箱</a><script language="javascript">
    function NewWindow(cb){
      var obj=document.getElementsByTagName("a");
      alert(obj.length);
      for(var i=0;i<obj.length;i++){
        if(cb.checked)
          obj[i].target="_blank";
        else
          obj[i].target="_self";
      }
    }
    </script>
      

  2.   

    <script>
    function AddLink(){
      var sText = document.selection.createRange();
      if (!sText==""){
        if (document.execCommand("CreateLink"))
           sText.parentElement().outerHTML=sText.parentElement().outerHTML.replace("<A","<A target=\"_blank\"");
      }
     else{
      alert("请先选择一些文本!");
     }
    }
    </script><P style="color=#3366CC">选我吧选我吧选我吧选我吧选我吧选我吧选我吧选我吧选我吧选我吧选我吧!</P><BUTTON onclick="AddLink()" unselectable="on">添加链接</BUTTON>