zoukankan      html  css  js  c++  java
  • 弹出一个淡入淡出的提示框,且自动消失

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
        <html>
        <head>
        <title>点击按钮弹出一个淡入淡出的提示框,且自动消失丨芯晴网页特效丨CsrCode.Cn</title>
        <SCRIPT>
        var intTimeStep=20;
        var isIe=(window.ActiveXObject)?true:false;
        var intAlphaStep=(isIe)?5:0.05;
        var curSObj=null;
        var curOpacity=null;
        var stopTime=0;
        function startObjMessage(objId)
        {
        curSObj=document.getElementById(objId);
        if(isIe){curSObj.style.cssText='DISPLAY: none; Z-INDEX: 1; FILTER: alpha(opacity=0); POSITION: absolute;';}
        setMessage();
        }
        function setMessage()
        {
        if(isIe){curSObj.filters.alpha.opacity=0;}
        else{curOpacity=0;curSObj.style.opacity=0}
        curSObj.style.display='';
        setMessageShow();
        }
        function setMessageShow()
        {
        if(isIe)
        {
        curSObj.filters.alpha.opacity+=intAlphaStep;
        if (curSObj.filters.alpha.opacity<100) {setTimeout('setMessageShow()',intTimeStep);}
        else{stopTime+=10;if(stopTime<500){setTimeout('setMessageShow()',intTimeStep);}else{stopTime=0;setMessageClose();}}
        }else
        {
        curOpacity+=intAlphaStep;
        curSObj.style.opacity =curOpacity;
        if (curOpacity<1) {setTimeout('setMessageShow()',intTimeStep);}
        else{stopTime+=10;if(stopTime<200){setTimeout('setMessageShow()',intTimeStep);}else{stopTime=0;setMessageClose();}}
        }
        }
        function setMessageClose()
        {
        if(isIe)
        {
        curSObj.filters.alpha.opacity-=intAlphaStep;
        if (curSObj.filters.alpha.opacity>0) {
        setTimeout('setMessageClose()',intTimeStep);
        }
        else {
        curSObj.style.display='none';
        }
        }
        else
        {
        curOpacity-=intAlphaStep;
        if (curOpacity>0) {
        curSObj.style.opacity =curOpacity;
        setTimeout('setMessageClose()',intTimeStep);
        }
        else {
        curSObj.style.display='none';
        }
        }
        }
        </SCRIPT>
        </head>
        <body>
        <table width=80% ID="Table1"><tr><td>预览效果:淡入淡出的弹出消息<br><input type=button onclick="startObjMessage('objDiv')" value="点击弹出消息" ID="Button1" NAME="Button1"></td>
        </tr>
        <tr><td><DIV id="objDiv" style="DISPLAY: none; Z-INDEX: 1; POSITION: absolute; ">
        <img src="/html/txdm_2/images/20100922/1_122131.gif">测试效果<img src="/html/txdm_2/images/20100922/1_122131.gif"></DIV></td></tr>
        </table>
        </body>
        </html>
        <p align="center">本特效由 <a href="http://www.CsrCode.cn" target="_blank">芯晴网页特效</a>丨CsrCode.Cn 收集于互联网,只为兴趣与学习交流,不作商业用途。</p>
        

  • 相关阅读:
    嵌入式Linux学习笔记 NAND Flash控制器
    (嵌入式开发)自己写bootloader之编写第一阶段
    C_C++指针指针应用详解
    数据结构笔记-----二叉排序树和哈希表
    map方法和filter方法
    nginx服务器卡住了 解决办法
    vue-devtoools 调试工具安装
    web 本地存储(localStorage、sessionStorage)
    vux使用教程
    一个页面从输入 URL 到页面加载显示完成,这个过程中都发生了什么?
  • 原文地址:https://www.cnblogs.com/xianyadan/p/6523049.html
Copyright © 2011-2022 走看看