关于像MSN的弹出窗口中innerHTML代码,点击后怎样弹出窗口中的连接或者再弹出一个窗口.

时间:2021-02-03 23:39:55

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<script   language="JavaScript">   
    var   PopWidth   =   181;   
    var   PopHeight   =   116;   
    var   PopShow   =   500000;   
    var   PopTop   =   0;   
    var   showtime,hidetime,PopBorder   =   16,PopHeightBorder   =   28;   
    var   oPopup   =   window.createPopup();   
      
    function   popmsg(msgstr)   
    {   
    oPopup.document.body.innerHTML   =   '<table   width="181"   height="116"   border="0"   cellspacing="0"   cellpadding="0"   bgcolor="#D9E8FF"  style="border-left:1px   solid   #A5B6CE;border-top:1px   solid   #A5B6CE;border-right:1px   solid   #425594;border-bottom:1px   solid   #425594;">'   +   
  '<tr>'   +   
  '<td   width="13"   height="23"   background="../images/Msn_Title_Bg.gif"   style="border-left:1px   solid   #FFFFFF;border-top:1px   solid   #FFFFFF;padding-left:5px;"><img src="images/msn1.jpg" width="17" height="17"></td>'   +   
  '<td   background="../images/Msn_Title_Bg.gif"   style="border-top:1px   solid   #FFFFFF;border-right:1px   solid   #CEDFF7;padding-left:5px;font-size:12px;font-family:Arial;color:#18306B;">系统66提示</td>'   +   
  '</tr>'   +   
  '<tr>   '   +   
  '<td   colspan="2"   style="border-left:1px   solid   #FFFFFF;border-right:1px   solid   #CEDFF7;border-bottom:1px   solid   #CEDFF7;">   '   +   
  '<table   width="100%"   height="100%"   border="0"   cellpadding="0"   cellspacing="0"   background="../images/Msn_Content_Bg.gif"   style="border-left:1px   solid   #738EBD;border-top:1px   solid   #738EBD;border-right:1px   solid   #BDCBEF;border-bottom:1px   solid   #BDCBEF;">'   +   
  '<tr>   '   +   
  '<td   width="66"   height="88"   align="center"><img   src="images/msn2.jpg"   width="50"   height="50"></td>'   +   
  '<td  align="center"  style="font-size:12px;font-family:Arial;color:#18306B;"> <a href="ttt.asp">我要打开新窗口</a><SPAN title=查看信息 style="FONT-WEIGHT: bold; FONT-SIZE: 12px; CURSOR: hand; COLOR: red; MARGIN-RIGHT: 4px" id="btCommandOpen" >打开弹出窗口</SPAN></td>'   +   
  '</tr>'   +   
   '</table></td>'   +   
  '</tr>'   +   
  '</table>';   
    popshow();   
    oPopup.document.body.onclick   =   pophide;   
    }   
      
    function   popshow()   
    {   
    var   tmpHeight   =   PopTop<PopHeight?PopTop:PopHeight;   
    oPopup.show(screen.width-(PopWidth+PopBorder),screen.height-PopTop,PopWidth,tmpHeight);   
    if(   PopTop   <   (PopHeight+PopHeightBorder)   )   
    {   
  PopTop   =   PopTop   +   5;   
    }else{   
  setTimeout("pophide();",PopShow);   
    }   
    showtime   =   setTimeout("popshow();",10);//100   
    }   
      
    function   pophide()   
    {   
    if(showtime){clearTimeout(showtime);}   
    var   tmpHeight   =   PopTop<PopHeight?PopTop:PopHeight;   
    oPopup.show(screen.width-(PopWidth+PopBorder),screen.height-PopTop,PopWidth,tmpHeight);   
    if(   PopTop>0   )   
    {   
    PopTop   =   PopTop   -   10;   
    hidetime   =   setTimeout("pophide();",10);   
    }else{   
    clearTimeout(hidetime);   
    oPopup.hide();   
    }   
    }   
      
    popmsg("userinfo");   

var btCommandOpen = oPopup.document.getElementById("btCommandOpen");  
    btCommandOpen.onclick = function()  
    {  
      userid="1000000";
   
      var t=oPopup.document.open('chatonline.asp?userid='+userid,'monitor','LOCATION=0,MENUBAR=0,RESIZABLE=0,SCROLLBARS=0,HEIGHT=547,WIDTH=632');
     if(t)
      {
        t.focus();
      }
    } 

    //->   
  </script>

=============================================================
在上面代码中,如果浏览器中设置不阻止弹出窗口,则可以显示,否则被阻止.

因此我想用连接做,即<a href...></a>来做,但是怎样都不打开连接中的网页.

请问怎么改,最好是两种办法都可以实现.

6 个解决方案

#1


自己先顶一下

#2


<a href=\"javascript:top.open(\'test.htm\');void(0);\">我要打开新窗口</a>

#3


路过~~

#4


hookee() : 还是不行, 请问top,void(0) 是什么意思呢?
提示错误,缺少对象.

#5


我试过可以啊,top指顶层窗口。ttt.asp要存在.

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<script   language="JavaScript">   
    var   PopWidth   =   181;   
    var   PopHeight   =   116;   
    var   PopShow   =   500000;   
    var   PopTop   =   0;   
    var   showtime,hidetime,PopBorder   =   16,PopHeightBorder   =   28;   
    var   oPopup   =   window.createPopup();   
      
    function   popmsg(msgstr)   
    {   
    oPopup.document.body.innerHTML   =   '<table   width="181"   height="116"   border="0"   cellspacing="0"   cellpadding="0"   bgcolor="#D9E8FF"  style="border-left:1px   solid   #A5B6CE;border-top:1px   solid   #A5B6CE;border-right:1px   solid   #425594;border-bottom:1px   solid   #425594;">'   +   
  '<tr>'   +   
  '<td   width="13"   height="23"   background="../images/Msn_Title_Bg.gif"   style="border-left:1px   solid   #FFFFFF;border-top:1px   solid   #FFFFFF;padding-left:5px;"><img src="images/msn1.jpg" width="17" height="17"></td>'   +   
  '<td   background="../images/Msn_Title_Bg.gif"   style="border-top:1px   solid   #FFFFFF;border-right:1px   solid   #CEDFF7;padding-left:5px;font-size:12px;font-family:Arial;color:#18306B;">系统66提示</td>'   +   
  '</tr>'   +   
  '<tr>   '   +   
  '<td   colspan="2"   style="border-left:1px   solid   #FFFFFF;border-right:1px   solid   #CEDFF7;border-bottom:1px   solid   #CEDFF7;">   '   +   
  '<table   width="100%"   height="100%"   border="0"   cellpadding="0"   cellspacing="0"   background="../images/Msn_Content_Bg.gif"   style="border-left:1px   solid   #738EBD;border-top:1px   solid   #738EBD;border-right:1px   solid   #BDCBEF;border-bottom:1px   solid   #BDCBEF;">'   +   
  '<tr>   '   +   
  '<td   width="66"   height="88"   align="center"><img   src="images/msn2.jpg"   width="50"   height="50"></td>'   +   
  '<td  align="center"  style="font-size:12px;font-family:Arial;color:#18306B;"> <a href="javascript:top.open(\'ttt.asp\');void(0);">我要打开新窗口</a><SPAN title=查看信息 style="FONT-WEIGHT: bold; FONT-SIZE: 12px; CURSOR: hand; COLOR: red; MARGIN-RIGHT: 4px" id="btCommandOpen" >打开弹出窗口</SPAN></td>'   +   
  '</tr>'   +   
  '</table></td>'   +   
  '</tr>'   +   
  '</table>';   
    popshow();   
    oPopup.document.body.onclick   =   pophide;   
    }   
      
    function   popshow()   
    {   
    var   tmpHeight   =   PopTop<PopHeight?PopTop:PopHeight;   
    oPopup.show(screen.width-(PopWidth+PopBorder),screen.height-PopTop,PopWidth,tmpHeight);   
    if(   PopTop   <   (PopHeight+PopHeightBorder)   )   
    {   
  PopTop   =   PopTop   +   5;   
    }else{   
  setTimeout("pophide();",PopShow);   
    }   
    showtime   =   setTimeout("popshow();",10);//100   
    }   
      
    function   pophide()   
    {   
    if(showtime){clearTimeout(showtime);}   
    var   tmpHeight   =   PopTop<PopHeight?PopTop:PopHeight;   
    oPopup.show(screen.width-(PopWidth+PopBorder),screen.height-PopTop,PopWidth,tmpHeight);   
    if(   PopTop>0   )   
    {   
    PopTop   =   PopTop   -   10;   
    hidetime   =   setTimeout("pophide();",10);   
    }else{   
    clearTimeout(hidetime);   
    oPopup.hide();   
    }   
    }   
      
    popmsg("userinfo");   

var btCommandOpen = oPopup.document.getElementById("btCommandOpen");  
    btCommandOpen.onclick = function()  
    {  
      userid="1000000";
   
      var t=oPopup.document.open('chatonline.asp?userid='+userid,'monitor','LOCATION=0,MENUBAR=0,RESIZABLE=0,SCROLLBARS=0,HEIGHT=547,WIDTH=632');
     if(t)
      {
        t.focus();
      }
    } 

    //->   
  </script>

#6


我的怎么不行呢?
ttt也存在,但是点击后打不开新窗口.

不管怎样,先揭贴,我新开一贴,希望大家继续帮助.
新贴地址:
http://community.csdn.net/Expert/topic/5619/5619809.xml?temp=.3715174


hookee() : 能否把你的邮箱留下,我把文件发给你,你帮我看看.
我也把我的邮箱留下,yf80xh@sohu.com , 把你的文件发给我.谢谢了!

#1


自己先顶一下

#2


<a href=\"javascript:top.open(\'test.htm\');void(0);\">我要打开新窗口</a>

#3


路过~~

#4


hookee() : 还是不行, 请问top,void(0) 是什么意思呢?
提示错误,缺少对象.

#5


我试过可以啊,top指顶层窗口。ttt.asp要存在.

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<script   language="JavaScript">   
    var   PopWidth   =   181;   
    var   PopHeight   =   116;   
    var   PopShow   =   500000;   
    var   PopTop   =   0;   
    var   showtime,hidetime,PopBorder   =   16,PopHeightBorder   =   28;   
    var   oPopup   =   window.createPopup();   
      
    function   popmsg(msgstr)   
    {   
    oPopup.document.body.innerHTML   =   '<table   width="181"   height="116"   border="0"   cellspacing="0"   cellpadding="0"   bgcolor="#D9E8FF"  style="border-left:1px   solid   #A5B6CE;border-top:1px   solid   #A5B6CE;border-right:1px   solid   #425594;border-bottom:1px   solid   #425594;">'   +   
  '<tr>'   +   
  '<td   width="13"   height="23"   background="../images/Msn_Title_Bg.gif"   style="border-left:1px   solid   #FFFFFF;border-top:1px   solid   #FFFFFF;padding-left:5px;"><img src="images/msn1.jpg" width="17" height="17"></td>'   +   
  '<td   background="../images/Msn_Title_Bg.gif"   style="border-top:1px   solid   #FFFFFF;border-right:1px   solid   #CEDFF7;padding-left:5px;font-size:12px;font-family:Arial;color:#18306B;">系统66提示</td>'   +   
  '</tr>'   +   
  '<tr>   '   +   
  '<td   colspan="2"   style="border-left:1px   solid   #FFFFFF;border-right:1px   solid   #CEDFF7;border-bottom:1px   solid   #CEDFF7;">   '   +   
  '<table   width="100%"   height="100%"   border="0"   cellpadding="0"   cellspacing="0"   background="../images/Msn_Content_Bg.gif"   style="border-left:1px   solid   #738EBD;border-top:1px   solid   #738EBD;border-right:1px   solid   #BDCBEF;border-bottom:1px   solid   #BDCBEF;">'   +   
  '<tr>   '   +   
  '<td   width="66"   height="88"   align="center"><img   src="images/msn2.jpg"   width="50"   height="50"></td>'   +   
  '<td  align="center"  style="font-size:12px;font-family:Arial;color:#18306B;"> <a href="javascript:top.open(\'ttt.asp\');void(0);">我要打开新窗口</a><SPAN title=查看信息 style="FONT-WEIGHT: bold; FONT-SIZE: 12px; CURSOR: hand; COLOR: red; MARGIN-RIGHT: 4px" id="btCommandOpen" >打开弹出窗口</SPAN></td>'   +   
  '</tr>'   +   
  '</table></td>'   +   
  '</tr>'   +   
  '</table>';   
    popshow();   
    oPopup.document.body.onclick   =   pophide;   
    }   
      
    function   popshow()   
    {   
    var   tmpHeight   =   PopTop<PopHeight?PopTop:PopHeight;   
    oPopup.show(screen.width-(PopWidth+PopBorder),screen.height-PopTop,PopWidth,tmpHeight);   
    if(   PopTop   <   (PopHeight+PopHeightBorder)   )   
    {   
  PopTop   =   PopTop   +   5;   
    }else{   
  setTimeout("pophide();",PopShow);   
    }   
    showtime   =   setTimeout("popshow();",10);//100   
    }   
      
    function   pophide()   
    {   
    if(showtime){clearTimeout(showtime);}   
    var   tmpHeight   =   PopTop<PopHeight?PopTop:PopHeight;   
    oPopup.show(screen.width-(PopWidth+PopBorder),screen.height-PopTop,PopWidth,tmpHeight);   
    if(   PopTop>0   )   
    {   
    PopTop   =   PopTop   -   10;   
    hidetime   =   setTimeout("pophide();",10);   
    }else{   
    clearTimeout(hidetime);   
    oPopup.hide();   
    }   
    }   
      
    popmsg("userinfo");   

var btCommandOpen = oPopup.document.getElementById("btCommandOpen");  
    btCommandOpen.onclick = function()  
    {  
      userid="1000000";
   
      var t=oPopup.document.open('chatonline.asp?userid='+userid,'monitor','LOCATION=0,MENUBAR=0,RESIZABLE=0,SCROLLBARS=0,HEIGHT=547,WIDTH=632');
     if(t)
      {
        t.focus();
      }
    } 

    //->   
  </script>

#6


我的怎么不行呢?
ttt也存在,但是点击后打不开新窗口.

不管怎样,先揭贴,我新开一贴,希望大家继续帮助.
新贴地址:
http://community.csdn.net/Expert/topic/5619/5619809.xml?temp=.3715174


hookee() : 能否把你的邮箱留下,我把文件发给你,你帮我看看.
我也把我的邮箱留下,yf80xh@sohu.com , 把你的文件发给我.谢谢了!