`

使用JAVASCRIPT实现弹出框,过一段时间自动消失

    博客分类:
  • js
阅读更多
引用:使用JAVASCRIPT实现弹出框,过一段时间自动消失


<script>    
  var oPopup;   
  var popTop=50;   
  var mytime;   
  function closemsg(){   
   try{   
    clearTimeout(mytime);   
   }catch(e){}   
   oPopup.hide();   
  }   
     
  function popshow(){   
   //window.status=popTop;   
   if(popTop>1160){   
    closemsg();   
    return;   
   }   
   if(popTop>1040&&popTop<1160){   
    oPopup.show(screen.width-195,screen.height,250,1160-popTop);   
   }   
   if(popTop>1000&&popTop<1040){   
    oPopup.show(screen.width-195,screen.height+(popTop-1160),250,116);   
   }   
   if(popTop<120){   
    oPopup.show(screen.width-195,screen.height,250,popTop);   
   }   
   if(popTop<160){   
    oPopup.show(screen.width-195,screen.height-popTop,250,116);   
   }   
   popTop+=10;   
   mytime=setTimeout("popshow();",100);   
  }   
     
  function popmsg(msgnum,msgstr){   
   oPopup = window.createPopup();   
   var winstr='<table style="border-top: #FFFFFF 1px solid; border-left: #FFFFFF 1px solid" cellSpacing=0 cellPadding=0 width="100%" bgcolor=#cfdef4 border=0>';   
   winstr   +='  <tr>';   
   winstr   +='   <td style="font-size: 12px; background-image: url(msgTopBg.gif); color: #0f2c8c" width=30 height=24></td>';   
   winstr   +='   <td style="font-weight: normal; font-size: 12px; background-image: url(msgTopBg.gif); color: #1f336b; padding-top: 4px;padding-left: 4px" valign=center width="100%"> 管理平台消息提示:</td>';   
   winstr   +='   <td style="background-image: url(msgTopBg.gif); padding-top: 2px;padding-right:2px" valign=center align=right width=19><span title=关闭 style="cursor: hand;color:red;font-size:12px;font-weight:bold;margin-right:4px;" onclick="window.parent.closemsg();">×</span></td>';   
   winstr   +='  </tr>';   
   winstr   +='  <tr>';   
   winstr   +='   <td style="padding-right: 1px; background-image: url(1msgBottomBg.jpg); padding-bottom: 1px" colSpan=3 height=90>';   
   winstr   +='    <div style="border-right: #b9c9ef 1px solid; padding-right: 13px; border-top: #728eb8 1px solid; padding-left: 13px; font-size: 12px; padding-bottom: 13px; border-left: #728eb8 1px solid; width: 100%; color: #1f336b; padding-top: 6px; border-bottom: #b9c9ef 1px solid; height: 100%">'   
   winstr   +='                    您有<font color=#FF0000>'+msgnum+'</font>条新短消息<br><br>';   
   winstr   +='           <div align=center style="word-break:break-all">';   
   winstr   +=msgstr;   
   winstr   +='     </div>';   
   winstr   +='    </div>';   
   winstr   +='   </td>';   
   winstr   +='  </tr>';   
   winstr   +='</table>';   
       
   oPopup.document.body.innerHTML = winstr;   
   popshow();   
  }   
  <!--上面是定议,下面是调用-->  
  popmsg(1,'msg');   
</script>  
1
0
分享到:
评论
2 楼 lyzhu 2009-03-07  
winstr
1 楼 kaituozhe6666 2008-06-04  

相关推荐

    使用JAVASCRIPT实现弹出框,过一段时间自动消失.txt

    使用JAVASCRIPT实现弹出框,过一段时间自动消失.txt

    程序天下:JavaScript实例自学手册

    20.18 弹出框式邮件发送 20.19 把网站作为用户的Active桌面 20.20 判断是否安装了flash插件 第21章 流行技术:DOM和userData的应用技巧 21.1 使用userData保存文本内容 21.2 使用userData保存select标记 21.3 使用...

    《程序天下:JavaScript实例自学手册》光盘源码

    20.18 弹出框式邮件发送 20.19 把网站作为用户的Active桌面 20.20 判断是否安装了flash插件 第21章 流行技术:DOM和userData的应用技巧 21.1 使用userData保存文本内容 21.2 使用userData保存select标记 21.3 使用...

    free-dialog:移动端WEB弹窗组件

    * 弹出一个没有标题栏也没有底部按键的气泡对话框,一段时间后自动消失 * @param content 气泡内的文本内容、DOM或二者的数组 * @param time 自动消失的时间(毫秒,缺省时为2000毫秒) */ // 例1:弹出一个气泡...

    ExtAspNet v2.2.1 (2009-4-1) 值得一看

    -Grid增加GetNoSelectionAlertInParentReference函数,用来表示没有选中任何一项时在父页面弹出对话框的JS代码。 -修正IE7下不能以下划线作为CSS中类名的前缀的BUG(feedback:Steve.Wei)。 -添加定时器控件Timer,...

    ExtAspNet_v2.3.2_dll

    -Grid增加GetNoSelectionAlertInParentReference函数,用来表示没有选中任何一项时在父页面弹出对话框的JS代码。 -修正IE7下不能以下划线作为CSS中类名的前缀的BUG(feedback:Steve.Wei)。 -添加定时器控件Timer,...

    大名鼎鼎SWFUpload- Flash+JS 上传

     file_dialog_start_handler : file_dialog_start_function, 当文件选取对话框弹出前出发的事件处理函数  file_queued_handler : file_queued_function,  file_queue_error_handler : file_queue_error_function...

    傲游浏览器3(Maxthon) 3.1.8.1000 正式版

    侧边栏使用扩展方式实现,高级用户可以通过"%appdata%\Maxthon3\Addons\"下的扩展包,自定义侧边栏按钮以及内容. 历史管理器 加入日历视图 广告过滤 加入广告过滤的分享及自动安装功能 本次更新包括以下功能优化: ...

    计算机应用技术(实用手册)

    Press f8 for bbs popup 按F8弹出BBS网页 Press ALT+F2 to boot from system Recovery 按ALT+F2进入根录进行设置 PC2-4300 Dual Channel interleaved 双通道技术 Initializing usb Controllers..done 装载USB控制 ...

Global site tag (gtag.js) - Google Analytics