推广 热搜: 劳务  海南  2024  合同  江苏  云南  劳务系统  2023  劳务派遣管理软件  劳务派遣管理系统 

js右下角提示信息

   2024-06-10 170
核心提示:p整理,留备用,高手请绕道。在实现过程中,遇到一个问题,通常在Js中获取对象的高度时,会使用obj.style.height.对没错,这句代
<p>整理,留备用,高手请绕道。在实现过程中,遇到一个问题,通常在Js中获取对象的高度时,会使用obj.style.height.对没错,这句代码的直观上是能够获取到。但有个前提。当对象的初始高度不是通过行内样式设定时。该表达式的返回是非数字。在练习中通过obj.offsetHeight来获取的。PS:示例兼容主流浏览器。实现代码:<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><htmlxmlns="http://www.w3.org/1999/xhtml"><head><metahttp-equiv="Content-Type"content="text/html;charset=gb2312"/><title>测试右下角弹出框</title><styletype="text/css">*{margin:0px;padding:0px;}#tips{position:absolute;right:5px;bottom:3px;width:200px;border:solid0pxred;height:0px;overflow:hidden;}#tips.first{height:30px;line-height:30px;text-align:left;width:200px;overflow:hidden;font-size:13px;font-weight:bold;background:#0066FF;color:white;text-indent:10px;}#tips.second{height:120px;width:200px;font-size:13px;color:#000000;line-height:20px;text-indent:23px;word-wrap:break-word;background:#ccc;}#link{line-height:30px;}#linka{font-size:13px;font-weight:bold;color:#000000;}</style><scriptlanguage="javascript"type="text/javascript">vartmr=null;//弹出层的高度varmaxHeight=150;//弹出时的步伐设定varstep=8;//弹出层的对象varobj=null;//执行频率varspeed=20;//弹出和缩回是参考的一个变量。varb=true;varstartIt=function(){obj=document.getElementById('tips');tmr=window.setInterval("showTips()",speed);}varshowTips=function(){var_height=parseInt(obj.offsetHeight);if(_height<maxHeight&&b==true){obj.style.height=_height+step+'px';obj.style.borderWidth=1+'px';}else{if(b==true){window.clearInterval(tmr);window.setTimeout(function(){//弹出的窗口在等待3秒钟后,自动缩回。tmr=window.setInterval("showTips()",speed);},3000);b=false;return;}if(_height-step<=0){obj.style.height='0px';window.clearInterval(tmr);b=true;return;}obj.style.height=_height-step+'px';obj.style.borderWidth=0+'px';}}</script></head><body><divid="link"><ahref="javascript:startIt();">您有新的消息,点击查看</a></div><divid="tips"><pclass="first">你有新的消息</p><pclass="second">www.起航劳务派遣系统.com已经有新的版本,请问是否要更新。</p></div></body></html>本文由www.起航劳务派遣系统.com原创转载请著名出处</p>
 
标签: 信息系统清单
反对 0举报 0 收藏 0 打赏 0评论 0
 
更多>同类资讯
推荐图文
推荐资讯
点击排行
网站首页  |  关于我们  |  联系方式  |  使用协议  |  版权隐私  |  网站地图  |  排名推广  |  广告服务  |  积分换礼  |  网站留言  |  RSS订阅  |  违规举报  |  粤ICP备18079127号  |  粤ICP备18079127号