zoukankan      html  css  js  c++  java
  • div代替window.alert,让这个div显示信息后,在指定之间时间内消失

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title></title>
    </head>
    <body>
    <div style="padding:2px;background:#06c none repeat scroll 0;position:absolute;z-index:3;color:white;top:1px;right:16px;display:none;" id="div_alert">&nbsp;添加成功…&nbsp;</div> 
    <script type="text/javascript">
    /*想写一个div代替window.alert,让这个div显示信息后,在指定之间时间内消失*/
             
    function aler(elementId,times){
                     
    this.elementId = elementId;
                     
    this.times = times;
                     
    this.show = function(){
                             window.setTimeout(
    this.bbb,1000);
                     }
                     
    this.bbb = function(){
                             document.getElementById(elementId).style.display
    ='';
                             window.setTimeout(
    this.ccc,2000);//就这一句出问题了,请大家帮忙解决
                     }
                     ccc 
    = function(){
                             document.getElementById(elementId).style.display
    ='none';

                     }
             }
             
    var aaa = new aler('div_alert',2000);
             aaa.show();
    </script>
    </body>
    </html>

  • 相关阅读:
    Office文档在线编辑的实现之二
    Office文档在线编辑的实现之一
    WebIM(5)----将WebIM嵌入到页面中
    WebIM(4)----Comet的特殊之处
    WebIM(3)----性能测试
    WebIM(2)---消息缓存
    WebIM(1)
    微信的通讯录首字母滑动的实现
    新浪微博认证新API调用
    Android小感悟-重写textview组件感悟
  • 原文地址:https://www.cnblogs.com/zkxp/p/1100608.html
Copyright © 2011-2022 走看看