popup 在失去焦点的时候会自动被关闭掉的吧, 所以建议你使用模态框:showModelessDialog('ttt.htm','','dialogWidth: 480px; dialogHeight: 360px; status: no; help: no');showModalDialog('ttt.htm','','dialogWidth: 480px; dialogHeight: 360px; status: no; help: no');

解决方案 »

  1.   

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>Dreamweaver MX精彩设计百例</title>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <style type="text/css">
    <!--
    .copyright {
    font-family: "Courier New", "Courier", "mono";
    font-size: 10px;
    color: #333333;
    font-weight: normal;
    }
    -->
    </style>
    <style type="text/css">
    <!--
    .main {
    font-family: "宋体";
    font-size: 12px;
    color: #000000;
    line-height: 25px;
    padding: 25px;
    }
    .sample {
    font-family: "宋体";
    font-size: 12px;
    color: #FFFFFF;
    }
    -->
    </style>
    <SCRIPT LANGUAGE="JavaScript1.2">
    <!--
    var imagepath="images/fly.gif" //指定运动的图片及路径
    var imagewidth=160 //根据图片的大小设置宽度和高度
    var imageheight=60
    var speed=5; //设置运动速度,数值越大速度越大
    var imageclick="dismiss" //设置点击图片的操作,如果你输入的是链接地址,那么页面将跳转到该地址,如果输入"dismiss",那么点击图片后图层消失
    var hideafter=0 //设置图层自动消失的时间,设置为0就不消失
    var isie=0;
    if(window.navigator.appName=="Microsoft Internet Explorer"&&window.navigator.appVersion.substring(window.navigator.appVersion.indexOf("MSIE")+5,window.navigator.appVersion.indexOf("MSIE")+8)>=5.5) {
      isie=1;}
    else {  isie=0; }
    if(isie){
    var preloadit=new Image()
    preloadit.src=imagepath }
    function pop() {
      if(isie) {
        x=x+dx;y=y+dy;
        oPopup.show(x, y, imagewidth, imageheight);
        if(x+imagewidth+5>screen.width) dx=-dx;
        if(y+imageheight+5>screen.height) dy=-dy;
        if(x<0) dx=-dx;
        if(y<0) dy=-dy;
        startani=setTimeout("pop();",50);  }}
    function dismisspopup(){
    clearTimeout(startani)
    oPopup.hide() }
    function dowhat(){
    if (imageclick=="dismiss")
    dismisspopup()
    else
    window.location=imageclick}
    if(isie) {
      var x=0,y=0,dx=speed,dy=speed;
      var oPopup = window.createPopup();
      var oPopupBody = oPopup.document.body;
      oPopupBody.style.cursor="hand"
      oPopupBody.innerHTML = '<IMG SRC="'+preloadit.src+'">';
      oPopup.document.body.onmouseover=new Function("clearTimeout(startani)")
      oPopup.document.body.onmouseout=pop
      oPopup.document.body.onclick=dowhat
      pop();
    if (hideafter>0)
    setTimeout("dismisspopup()",hideafter*1000)}
    // -->
    </SCRIPT>
    </head><body background="images/main_bg.gif" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
    <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td height="35" valign="middle" bgcolor="#CCCCCC">&nbsp;&nbsp;&nbsp;<img src="images/title.gif" width="233" height="23"></td>
      </tr>
      <tr>
        <td height="20" align="left" valign="middle" bgcolor="#999999" class="sample">&nbsp;&nbsp;&nbsp;&nbsp;实例 
          超越窗口的束缚</td>
      </tr>
      <tr>
        <td align="center" valign="top" class="main"><p>将浏览器窗口最小化,你会发现图层依旧在屏幕中飞舞!</p>
          <p>本例特效在IE5.5及以上版本有效</p>
          </td>
      </tr>
      <tr>
        <td height="1" align="left" valign="bottom" bgcolor="#999999"><img src="images/space.gif" width="1" height="1"></td>
      </tr>
      <tr>
        <td height="20" align="right" valign="middle" bgcolor="#CCCCCC" class="copyright">&copy;2002 Fans8 Development. All Rights Reserved&nbsp;&nbsp;&nbsp;&nbsp; 
        </td>
      </tr>
    </table>
    </body>
    </html>
      

  2.   

    老实说,我还有点看不懂!
    我的代码是这样的:
    <script language='JavaScript'>
    var oPopup = window.createPopup();
    var popTop=50;
    function popmsg(msgstr){
    var winstr="<link rel=\"stylesheet\" href=\"style.css\" type=\"text/css\">";
    winstr+="<table width=\"200\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" height=\"150\" bgcolor=\"#FFFFFF\"><tr><td background=\"image/operwin.gif\" valign=\"top\">";
    winstr+="<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr>"; 
    winstr+="<td height=\"35\" width=\"12%\">&nbsp;</td><td height=\"35\" width=\"88%\">&nbsp;</td></tr><tr>"; 
    winstr+="<td width=\"12%\" align=\"center\"><img src=\"image/old_icon.gif\" width=\"10\" height=\"11\"></td>";
    winstr+="<td width=\"88%\">您有新的留言 - </td></tr><tr><td colspan=\"2\" align=\"center\">"; 
    winstr+="<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td width=\"9%\"></td>";
    winstr+="<td width=\"91%\"><img src=\"image/operwin_line.gif\" width=\"148\" height=\"3\"></td></tr></table></td></tr><tr>";
    winstr+="<td width=\"12%\" align=\"center\"><img src=\"image/old_icon.gif\" width=\"10\" height=\"11\"></td><td width=\"88%\">您有新的约会 - </td>";
    winstr+="</tr><tr><td colspan=\"2\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
    winstr+="<tr><td width=\"9%\"></td><td width=\"91%\"><img src=\"image/operwin_line.gif\" width=\"148\" height=\"3\"></td>";
    winstr+="</tr></table></td></tr><tr align=\"center\"><td colspan=\"2\" height=\"65\">"+msgstr+"</td></tr></table></td></tr></table>";
    oPopup.document.body.innerHTML = winstr;
    popshow();
    }
    function popshow(){
    window.status=popTop;
    if(popTop>1720){
    clearTimeout(mytime);
    oPopup.hide();
    return;
    }else if(popTop>1520&&popTop<1720){
    oPopup.show(screen.width-218,screen.height,200,1720-popTop);
    }else if(popTop>1500&&popTop<1520){
    oPopup.show(screen.width-218,screen.height+(popTop-1720),200,150);
    }else if(popTop<180){
    oPopup.show(screen.width-218,screen.height,200,popTop);
    }else if(popTop<220){
    oPopup.show(screen.width-218,screen.height-popTop,200,150);
    }
    popTop+=10;
    var mytime=setTimeout("popshow();",50);
    }
    popmsg("<font color=000000>广告信息</font>");
    </script>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <html>
      <head>
        <title>Popup</title>
        <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
        <meta name="CODE_LANGUAGE" Content="C#">
        <meta name=vs_defaultClientScript content="JavaScript">
        <meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5">
        <meta http-equiv="refresh" content="30">
      </head>
      <body MS_POSITIONING="GridLayout">

        <form name="Form1" method="post" action="popup.aspx" id="Form1">
    <input type="hidden" name="__VIEWSTATE" value="dDwtMTI3OTMzNDM4NDs7Prjw+1llVrRolaWGjh6oZAOg/rUg" />
         </form>

      </body>
    </html>
    =======================================
    我如何让我弹出的窗口不消失呢?
      

  3.   

    我想得到的效果,当每一次加载页面的时候弹出,当我点击这个页面时,那个弹出页面不消失
    当到了SetTimeout之后它自动消失!!
    就是popup 在失去焦点的时候会自动被关闭掉的问题!
      

  4.   

    function popshow(){
    window.status=popTop;
    if(popTop>1780){
    clearTimeout(mytime);
    //oPopup.hide();
    return;
    }else if(popTop>1520){
    //oPopup.show(screen.width-250,screen.height,241,1710-popTop);
    }else if(popTop>1500&&popTop<1520){
    oPopup.show(screen.width-250,screen.height+(popTop-1720),241,172);
    }else if(popTop<180){
    oPopup.show(screen.width-250,screen.height,241,popTop);
    }else if(popTop<220){
    oPopup.show(screen.width-250,screen.height-popTop,241,172);
    }
    if(popTop<1510)
    {
    popTop+=10;
    var mytime=setTimeout("popshow();",50);
    //document.body.onmouseout=popshow;
    }
    else
    {
    window.setInterval("oPopup.show(screen.width-250,screen.height+(popTop-1720),241,172)",1000)
    //document.body.onmouseout=popshow;
    //oPopup.hide();
    //oPopup.show(screen.width-250,screen.height,241,1720-popTop);
    }