请教一个效果该如何实现 最近想做一个特效:网页的两个区域(两个div)在网页载入时依次从屏幕的下方滑入到屏幕中固定位置,该如何编写?哪位朋友做过?谢谢!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 具体怎么做我就不说了说几个重要的函数div.style.top clientY判断高度setTimeout();position:absolute; to NIHAOX1 好!<html><head><title>移动DIV演示</title></head><BODY><Script language="javascript"><!--window.onload = getMsg;window.onresize = resizeDiv;window.onerror = function(){}var divTop,divLeft,divWidth,divHeight,docHeight,docWidth,divTopnew,divLeftnew,divWidthnew,divHeightnew,docHeightnew,docWidthnew,objTimer,objTimernew,i = 0;function getMsg(){try{divTop = parseInt(document.getElementById("eMeng").style.top,10)divLeft = parseInt(document.getElementById("eMeng").style.left,10)divHeight = parseInt(document.getElementById("eMeng").offsetHeight,10)divWidth = parseInt(document.getElementById("eMeng").offsetWidth,10)docWidth = document.body.clientWidth;docHeight = document.body.clientHeight;document.getElementById("eMeng").style.top = parseInt(document.body.scrollTop,10) + docHeight + 10;// divHeightdocument.getElementById("eMeng").style.left = 500document.getElementById("eMeng").style.visibility="visible"divTopnew = parseInt(document.getElementById("eMengnew").style.top,10)divLeftnew = parseInt(document.getElementById("eMengnew").style.left,10)divHeightnew = parseInt(document.getElementById("eMengnew").offsetHeight,10)divWidthnew = parseInt(document.getElementById("eMengnew").offsetWidth,10)docWidthnew = document.body.clientWidth;docHeightnew = document.body.clientHeight;document.getElementById("eMengnew").style.top = parseInt(document.body.scrollTop,10) + docHeight + 10;// divHeightdocument.getElementById("eMengnew").style.left = 500document.getElementById("eMengnew").style.visibility="visible"objTimer = window.setInterval("moveDiv()",10)}catch(e){}}function resizeDiv(){i+=1if(i>1300) closeDiv() //客户想不用自动消失由用户来自己关闭所以屏蔽这句try{divHeight = parseInt(document.getElementById("eMeng").offsetHeight,10)divWidth = parseInt(document.getElementById("eMeng").offsetWidth,10)docWidth = document.body.clientWidth;docHeight = document.body.clientHeight;document.getElementById("eMeng").style.top = docHeight - divHeight + parseInt(document.body.scrollTop,10)-200document.getElementById("eMeng").style.left = 500}catch(e){}}function resizeDivnew(){i+=1if(i>1300) closeDiv() //客户想不用自动消失由用户来自己关闭所以屏蔽这句try{divHeightnew = parseInt(document.getElementById("eMengnew").offsetHeight,10)divWidthnew = parseInt(document.getElementById("eMengnew").offsetWidth,10)docWidthnew = document.body.clientWidth;docHeightnew = document.body.clientHeight;document.getElementById("eMengnew").style.top = docHeightnew - divHeightnew + parseInt(document.body.scrollTop,10)-80document.getElementById("eMengnew").style.left = 500}catch(e){}}function moveDiv(){try{if(parseInt(document.getElementById("eMeng").style.top,10) <= (docHeight - divHeight + parseInt(document.body.scrollTop,10)) -200){window.clearInterval(objTimer)objTimer = window.setInterval("resizeDiv()",1)}if(parseInt(document.getElementById("eMeng").style.top,10) <= (docHeight - divHeight + parseInt(document.body.scrollTop,10))){ objTimernew = window.setInterval("moveDivnew()",182) }divTop = parseInt(document.getElementById("eMeng").style.top,10)document.getElementById("eMeng").style.top = divTop - 2}catch(e){}}function moveDivnew(){try{if(parseInt(document.getElementById("eMengnew").style.top,10) <= (docHeightnew - divHeightnew + parseInt(document.body.scrollTop,10)) -80){widows.clearInterval(objTimernew)objTimernew = window.setInterval("resizeDivnew()",1)}divTopnew = parseInt(document.getElementById("eMengnew").style.top,10)document.getElementById("eMengnew").style.top = divTopnew - 1}catch(e){}}function closeDiv(){document.getElementById('eMeng').style.visibility='hidden';if(objTimer) window.clearInterval(objTimer)}--></Script><DIV id=eMeng style="BORDER-RIGHT: #455690 1px solid; BORDER-TOP: #a6b4cf 1px solid; Z-INDEX:99999; LEFT: 0px; VISIBILITY: hidden; BORDER-LEFT: #a6b4cf 1px solid; WIDTH: 180px; BORDER-BOTTOM: #455690 1px solid; POSITION: absolute; TOP: 0px; HEIGHT: 116px; BACKGROUND-COLOR: #c9d3f3"><TABLE style="BORDER-TOP: #ffffff 1px solid; BORDER-LEFT: #ffffff 1px solid" cellSpacing=0 cellPadding=0 width="100%" bgColor=#AFDCF3 border=0><TBODY><TR bgColor=#6699cc><TD style="font-size: 12px; background-image: url('images/msgTopBg.gif'); color: #0f2c8c" width=30 height=24></TD><TD style="font-weight: normal; font-size: 12px; background-image: url('images/msgTopBg.gif'); color: #ffffff; padding-left: 4px; padding-top: 4px" vAlign=center width="100%"><font color="red">最新公告</font></TD><TD style="background-image: url('images/msgTopBg.gif'); padding-right: 2px; padding-top: 2px" vAlign=center align=right width=19><span title=关闭 style="CURSOR: hand;color:white;font-size:12px;font-weight:bold;margin-right:4px;" onclick=closeDiv() >×</span></TD></TR><TR><TD style="background-image: url('UploadFiles/200510822587734.jpg'); padding-right: 1px; padding-bottom: 1px" colSpan=3 height=90><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: 18px; BORDER-BOTTOM: #b9c9ef 1px solid; HEIGHT: 100%">高晓松8日凌晨出狱身价暴涨<br>长寿药最快5年后问世<BR></DIV></TD></TR></TBODY></TABLE></DIV><DIV id=eMengnew style="BORDER-RIGHT: #455690 1px solid; BORDER-TOP: #a6b4cf 1px solid; Z-INDEX:99999; LEFT: 0px; VISIBILITY: hidden; BORDER-LEFT: #a6b4cf 1px solid; WIDTH: 180px; BORDER-BOTTOM: #455690 1px solid; POSITION: absolute; TOP: 0px; HEIGHT: 116px; BACKGROUND-COLOR: #c9d3f3"><TABLE style="BORDER-TOP: #ffffff 1px solid; BORDER-LEFT: #ffffff 1px solid" cellSpacing=0 cellPadding=0 width="100%" bgColor=#AFDCF3 border=0><TBODY><TR bgColor=#6699cc><TD style="font-size: 12px; background-image: url('images/msgTopBg.gif'); color: #0f2c8c" width=30 height=24></TD><TD style="font-weight: normal; font-size: 12px; background-image: url('images/msgTopBg.gif'); color: #ffffff; padding-left: 4px; padding-top: 4px" vAlign=center width="100%"><font color="red">功能区域</font></TD><TD style="background-image: url('images/msgTopBg.gif'); padding-right: 2px; padding-top: 2px" vAlign=center align=right width=19><span title=关闭 style="CURSOR: hand;color:white;font-size:12px;font-weight:bold;margin-right:4px;" onclick=closeDiv() >×</span></TD></TR><TR><TD style="background-image: url('UploadFiles/200510822587734.jpg'); padding-right: 1px; padding-bottom: 1px" colSpan=3 height=90><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: 18px; BORDER-BOTTOM: #b9c9ef 1px solid; HEIGHT: 100%">待办文件<br>待阅文件<br>已办文件<br>已阅文件<BR></DIV></TD></TR></TBODY></TABLE></DIV></BODY></HTML>我的做法是先起了一个objTimer运行一个div,在objTimer控制的函数中又起了一个objTimernew,开始两个时钟设置的相同,但表示出来的效果不同,为什么呢? 先提个意见 function $(str){return(document.getElementById(str));}在下面的函数里直接引用就好了免得写那么多document.....在看代码 等等 <html><head><title>移动DIV演示</title></head><BODY><Script language="javascript"><!--window.onload = getMsg;window.onresize = resizeDiv;window.onerror = function(){}var divTop,divLeft,divWidth,divHeight,docHeight,docWidth,divTopnew,divLeftnew,divWidthnew,divHeightnew,docHeightnew,docWidthnew,objTimer,objTimernew,i = 0;function getMsg(){try{divTop = parseInt(document.getElementById("eMeng").style.top,10)divLeft = parseInt(document.getElementById("eMeng").style.left,10)divHeight = parseInt(document.getElementById("eMeng").offsetHeight,10)divWidth = parseInt(document.getElementById("eMeng").offsetWidth,10)docWidth = document.body.clientWidth;docHeight = document.body.clientHeight;document.getElementById("eMeng").style.top = parseInt(document.body.scrollTop,10) + docHeight + 10;// divHeightdocument.getElementById("eMeng").style.left = 500+"px";document.getElementById("eMeng").style.visibility="visible"divTopnew = parseInt(document.getElementById("eMengnew").style.top,10)divLeftnew = parseInt(document.getElementById("eMengnew").style.left,10)divHeightnew = parseInt(document.getElementById("eMengnew").offsetHeight,10)divWidthnew = parseInt(document.getElementById("eMengnew").offsetWidth,10)docWidthnew = document.body.clientWidth;docHeightnew = document.body.clientHeight;document.getElementById("eMengnew").style.top = parseInt(document.body.scrollTop,10) + docHeight + 10;// divHeightdocument.getElementById("eMengnew").style.left = 500+"px";document.getElementById("eMengnew").style.visibility="visible"objTimer = window.setInterval("moveDiv()",10)}catch(e){}}function resizeDiv(){i+=1if(i>1300) closeDiv() //客户想不用自动消失由用户来自己关闭所以屏蔽这句try{divHeight = parseInt(document.getElementById("eMeng").offsetHeight,10)divWidth = parseInt(document.getElementById("eMeng").offsetWidth,10)docWidth = document.body.clientWidth;docHeight = document.body.clientHeight;document.getElementById("eMeng").style.top = docHeight - divHeight + parseInt(document.body.scrollTop,10)-200document.getElementById("eMeng").style.left = 500}catch(e){}}function resizeDivnew(){i+=1if(i>1300) closeDiv() //客户想不用自动消失由用户来自己关闭所以屏蔽这句try{divHeightnew = parseInt(document.getElementById("eMengnew").offsetHeight,10)divWidthnew = parseInt(document.getElementById("eMengnew").offsetWidth,10)docWidthnew = document.body.clientWidth;docHeightnew = document.body.clientHeight;document.getElementById("eMengnew").style.top = docHeightnew - divHeightnew + parseInt(document.body.scrollTop,10)-80document.getElementById("eMengnew").style.left = 500}catch(e){}}function moveDiv(){try{if(parseInt(document.getElementById("eMeng").style.top,10) <= (docHeight - divHeight + parseInt(document.body.scrollTop,10)) -200){window.clearInterval(objTimer)objTimer = window.setInterval("resizeDiv()",1)}if(parseInt(document.getElementById("eMeng").style.top,10) <= (docHeight - divHeight + parseInt(document.body.scrollTop,10))){ objTimernew = window.setInterval("moveDivnew()",182) }divTop = parseInt(document.getElementById("eMeng").style.top,10)document.getElementById("eMeng").style.top = divTop - 2}catch(e){}}function moveDivnew(){try{if(parseInt(document.getElementById("eMengnew").style.top,10) <= (docHeightnew - divHeightnew + parseInt(document.body.scrollTop,10)) -80){widows.clearInterval(objTimernew)objTimernew = window.setInterval("resizeDivnew()",1)}divTopnew = parseInt(document.getElementById("eMengnew").style.top,10)document.getElementById("eMengnew").style.top = divTopnew - 1}catch(e){}}function closeDiv(){document.getElementById('eMeng').style.visibility='hidden';if(objTimer) window.clearInterval(objTimer)}--></Script><DIV id="eMeng" style="BORDER-RIGHT: #455690 1px solid; BORDER-TOP: #a6b4cf 1px solid; Z-INDEX:99999; LEFT: 0px; VISIBILITY: hidden; BORDER-LEFT: #a6b4cf 1px solid; WIDTH: 180px; BORDER-BOTTOM: #455690 1px solid; POSITION: absolute; TOP: 0px; HEIGHT: 116px; BACKGROUND-COLOR: #c9d3f3;"><TABLE style="BORDER-TOP: #ffffff 1px solid; BORDER-LEFT: #ffffff 1px solid" cellSpacing=0 cellPadding=0 width="100%" bgColor=#AFDCF3 border=0><TBODY><TR bgColor=#6699cc><TD style="font-size: 12px; background-image: url('images/msgTopBg.gif'); color: #0f2c8c" width=30 height=24></TD><TD style="font-weight: normal; font-size: 12px; background-image: url('images/msgTopBg.gif'); color: #ffffff; padding-left: 4px; padding-top: 4px" vAlign=center width="100%"><font color="red">最新公告</font></TD><TD style="background-image: url('images/msgTopBg.gif'); padding-right: 2px; padding-top: 2px" vAlign=center align=right width=19><span title=关闭 style="CURSOR: hand;color:white;font-size:12px;font-weight:bold;margin-right:4px;" onclick=closeDiv() >×</span></TD></TR><TR><TD style="background-image: url('UploadFiles/200510822587734.jpg'); padding-right: 1px; padding-bottom: 1px" colSpan=3 height=90><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: 18px; BORDER-BOTTOM: #b9c9ef 1px solid; HEIGHT: 100%;">高晓松8日凌晨出狱身价暴涨<br>长寿药最快5年后问世<BR></DIV></TD></TR></TBODY></TABLE></DIV><DIV id="eMengnew" style="BORDER-RIGHT: #455690 1px solid; BORDER-TOP: #a6b4cf 1px solid; Z-INDEX:99999; LEFT: 0px; VISIBILITY: hidden; BORDER-LEFT: #a6b4cf 1px solid; WIDTH: 180px; BORDER-BOTTOM: #455690 1px solid; POSITION: absolute; TOP: 0px; HEIGHT: 116px; BACKGROUND-COLOR: #c9d3f3;"><TABLE style="BORDER-TOP: #ffffff 1px solid; BORDER-LEFT: #ffffff 1px solid" cellSpacing=0 cellPadding=0 width="100%" bgColor=#AFDCF3 border=0><TBODY><TR bgColor=#6699cc><TD style="font-size: 12px; background-image: url('images/msgTopBg.gif'); color: #0f2c8c" width=30 height=24></TD><TD style="font-weight: normal; font-size: 12px; background-image: url('images/msgTopBg.gif'); color: #ffffff; padding-left: 4px; padding-top: 4px" vAlign=center width="100%"><font color="red">功能区域</font></TD><TD style="background-image: url('images/msgTopBg.gif'); padding-right: 2px; padding-top: 2px" vAlign=center align=right width=19><span title=关闭 style="CURSOR: hand;color:white;font-size:12px;font-weight:bold;margin-right:4px;" onclick=closeDiv() >×</span></TD></TR><TR><TD style="background-image: url('UploadFiles/200510822587734.jpg'); padding-right: 1px; padding-bottom: 1px" colSpan=3 height=90><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: 18px; BORDER-BOTTOM: #b9c9ef 1px solid; HEIGHT: 100%;">待办文件<br>待阅文件<br>已办文件<br>已阅文件<BR></DIV></TD></TR></TBODY></TABLE></DIV></BODY></HTML>试试 看看这个是不是 你要的效果 不好意思,我今天刚学js,在网上找的,改了改。<html><head><title>滑动DIV演示</title></head><BODY><Script language="javascript">function getID(str){return(document.getElementById(str));}<!--window.onload = getMsg;window.onresize = resizeDiv;var divTop,divLeft,divWidth,divHeight,docHeight,docWidth,divTopnew,divLeftnew,divWidthnew,divHeightnew,docHeightnew,docWidthnew,objTimer,objTimernew,i = 0;function getMsg(){try{divTop = parseInt(getID("eMeng").style.top,10)divLeft = parseInt(getID("eMeng").style.left,10)divHeight = parseInt(getID("eMeng").offsetHeight,10)divWidth = parseInt(getID("eMeng").offsetWidth,10)docWidth = document.body.clientWidth;docHeight = document.body.clientHeight;getID("eMeng").style.top = parseInt(document.body.scrollTop,10) + docHeight + 10;getID("eMeng").style.left = 500getID("eMeng").style.visibility="visible"divTopnew = parseInt(getID("eMengnew").style.top,10)divLeftnew = parseInt(getID("eMengnew").style.left,10)divHeightnew = parseInt(getID("eMengnew").offsetHeight,10)divWidthnew = parseInt(getID("eMengnew").offsetWidth,10)docWidthnew = document.body.clientWidth;docHeightnew = document.body.clientHeight;getID("eMengnew").style.top = parseInt(document.body.scrollTop,10) + docHeight + 10;getID("eMengnew").style.left = 500getID("eMengnew").style.visibility="visible"objTimer = window.setInterval("moveDiv()",10)}catch(e){}}function resizeDiv(){i+=1if(i>1300) closeDiv() //客户想不用自动消失由用户来自己关闭所以屏蔽这句try{divHeight = parseInt(getID("eMeng").offsetHeight,10)divWidth = parseInt(getID("eMeng").offsetWidth,10)docWidth = document.body.clientWidth;docHeight = document.body.clientHeight;getID("eMeng").style.top = docHeight - divHeight + parseInt(document.body.scrollTop,10)-200getID("eMeng").style.left = 500}catch(e){}}function resizeDivnew(){i+=1if(i>1300) closeDiv() //客户想不用自动消失由用户来自己关闭所以屏蔽这句try{divHeightnew = parseInt(getID("eMengnew").offsetHeight,10)divWidthnew = parseInt(getID("eMengnew").offsetWidth,10)docWidthnew = document.body.clientWidth;docHeightnew = document.body.clientHeight;getID("eMengnew").style.top = docHeightnew - divHeightnew + parseInt(document.body.scrollTop,10)-80getID("eMengnew").style.left = 500}catch(e){}}function moveDiv(){try{if(parseInt(getID("eMeng").style.top,10) <= (docHeight - divHeight + parseInt(document.body.scrollTop,10)) -200){window.clearInterval(objTimer)objTimer = window.setInterval("resizeDiv()",1)}if(parseInt(getID("eMeng").style.top,10) <= (docHeight - divHeight + parseInt(document.body.scrollTop,10))){ objTimernew = window.setInterval("moveDivnew()",10) }divTop = parseInt(getID("eMeng").style.top,10)getID("eMeng").style.top = divTop - 1}catch(e){}}function moveDivnew(){try{if(parseInt(getID("eMengnew").style.top,10) <= (docHeightnew - divHeightnew + parseInt(document.body.scrollTop,10)) -80){widows.clearInterval(objTimernew)objTimernew = window.setInterval("resizeDivnew()",1)}divTopnew = parseInt(getID("eMengnew").style.top,10)getID("eMengnew").style.top = divTopnew - 1}catch(e){}}function closeDiv(){getID('eMeng').style.visibility='hidden';if(objTimer) window.clearInterval(objTimer)}--></Script><DIV id=eMeng style="BORDER-RIGHT: #455690 1px solid; BORDER-TOP: #a6b4cf 1px solid; Z-INDEX:99999; LEFT: 0px; VISIBILITY: hidden; BORDER-LEFT: #a6b4cf 1px solid; WIDTH: 180px; BORDER-BOTTOM: #455690 1px solid; POSITION: absolute; TOP: 0px; HEIGHT: 116px; BACKGROUND-COLOR: #c9d3f3"><TABLE style="BORDER-TOP: #ffffff 1px solid; BORDER-LEFT: #ffffff 1px solid" cellSpacing=0 cellPadding=0 width="100%" bgColor=#AFDCF3 border=0><TBODY><TR bgColor=#6699cc><TD style="font-size: 12px; background-image: url('images/msgTopBg.gif'); color: #0f2c8c" width=30 height=24></TD><TD style="font-weight: normal; font-size: 12px; background-image: url('images/msgTopBg.gif'); color: #ffffff; padding-left: 4px; padding-top: 4px" vAlign=center width="100%"><font color="red">最新公告</font></TD><TD style="background-image: url('images/msgTopBg.gif'); padding-right: 2px; padding-top: 2px" vAlign=center align=right width=19><span title=关闭 style="CURSOR: hand;color:white;font-size:12px;font-weight:bold;margin-right:4px;" onclick=closeDiv() >×</span></TD></TR><TR><TD style="background-image: url('UploadFiles/200510822587734.jpg'); padding-right: 1px; padding-bottom: 1px" colSpan=3 height=90><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: 18px; BORDER-BOTTOM: #b9c9ef 1px solid; HEIGHT: 100%">高晓松8日凌晨出狱身价暴涨<br>长寿药最快5年后问世<BR></DIV></TD></TR></TBODY></TABLE></DIV><DIV id=eMengnew style="BORDER-RIGHT: #455690 1px solid; BORDER-TOP: #a6b4cf 1px solid; Z-INDEX:99999; LEFT: 0px; VISIBILITY: hidden; BORDER-LEFT: #a6b4cf 1px solid; WIDTH: 180px; BORDER-BOTTOM: #455690 1px solid; POSITION: absolute; TOP: 0px; HEIGHT: 116px; BACKGROUND-COLOR: #c9d3f3"><TABLE style="BORDER-TOP: #ffffff 1px solid; BORDER-LEFT: #ffffff 1px solid" cellSpacing=0 cellPadding=0 width="100%" bgColor=#AFDCF3 border=0><TBODY><TR bgColor=#6699cc><TD style="font-size: 12px; background-image: url('images/msgTopBg.gif'); color: #0f2c8c" width=30 height=24></TD><TD style="font-weight: normal; font-size: 12px; background-image: url('images/msgTopBg.gif'); color: #ffffff; padding-left: 4px; padding-top: 4px" vAlign=center width="100%"><font color="red">功能区域</font></TD><TD style="background-image: url('images/msgTopBg.gif'); padding-right: 2px; padding-top: 2px" vAlign=center align=right width=19><span title=关闭 style="CURSOR: hand;color:white;font-size:12px;font-weight:bold;margin-right:4px;" onclick=closeDiv() >×</span></TD></TR><TR><TD style="background-image: url('UploadFiles/200510822587734.jpg'); padding-right: 1px; padding-bottom: 1px" colSpan=3 height=90><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: 18px; BORDER-BOTTOM: #b9c9ef 1px solid; HEIGHT: 100%">待办文件<br>待阅文件<br>已办文件<br>已阅文件<BR></DIV></TD></TR></TBODY></TABLE></DIV></BODY></HTML> 我想让两个div以相同的速度,依次从屏幕底部滑入,谢谢!!objTimer = window.setInterval("moveDiv()",10)function moveDiv(){try{if(parseInt(document.getElementById("eMeng").style.top,10) <= (docHeight - divHeight + parseInt(document.body.scrollTop,10)) -200){window.clearInterval(objTimer)objTimer = window.setInterval("resizeDiv()",1)}if(parseInt(document.getElementById("eMeng").style.top,10) <= (docHeight - divHeight + parseInt(document.body.scrollTop,10))){ objTimernew = window.setInterval("moveDivnew()",10) }divTop = parseInt(document.getElementById("eMeng").style.top,10)document.getElementById("eMeng").style.top = divTop - 1}catch(e){}}function moveDivnew(){try{if(parseInt(document.getElementById("eMengnew").style.top,10) <= (docHeightnew - divHeightnew + parseInt(document.body.scrollTop,10)) -80){widows.clearInterval(objTimernew)objTimernew = window.setInterval("resizeDivnew()",1)}divTopnew = parseInt(document.getElementById("eMengnew").style.top,10)document.getElementById("eMengnew").style.top = divTopnew - 1}catch(e){}} <script type="text/javascript">function a(){ var n=document.getElementById("show1"); if(parseInt(n.style.top)>300) { n.style.top=parseInt(n.style.top)-1+"px"; } if(parseInt(n.style.top)<400) b(); t=setTimeout('a()',10);}function b(){ var n=document.getElementById("show2"); if(parseInt(n.style.top)>300) n.style.top=parseInt(n.style.top)-1+"px";}</script><body bgcolor="#669900" onLoad="a()"><div id="show1" style="width:100px; height:75px; background-color:#FF00FF; position:absolute;left:600px; top:500px; border:#000000 1px solid; display:inline;"></div><div id="show2" style="width:100px; height:75px; background-color:#333333; position:absolute;left:600px; top:500px; border:#000000 1px solid; display:inline;"></div></body>下午在上课 刚才才考完试回来这个没做判断 你可以去改改 不知道是不是你要的效果 兄弟,多谢!就这个效果,从中得出结论:昨天我debug了一下,发现时钟(两个时钟设置一样间隔)嵌套,运行起来,两个div速度就不一样了,被嵌套的那个描画要快好多。多谢帮助!! to foun1046你说的是flash? 如何把object做排列(依string)? 怎样删除结点链接啊??? 如何去掉黑边框,请高手指教,谢谢 EXTJS从tree拖拽到view的问题 求完整百度搜索引擎的源代码 乘法计算问题 <a>的伪协议JavaScript 不重新 发送信息,则无法刷新网页??? 另加100分求救, up者有分 ---在线等待---遍历显示集合的简单问题? ~~~ easyUI 中 datagrid 中文本框双击事件多次执行 ~~~ 帮忙写一个正则表达式
说几个重要的函数
div.style.top
clientY判断高度
setTimeout();
position:absolute;
<html>
<head>
<title>移动DIV演示</title>
</head><BODY><Script language="javascript">
<!--
window.onload = getMsg;
window.onresize = resizeDiv;
window.onerror = function(){}var divTop,divLeft,divWidth,divHeight,docHeight,docWidth,divTopnew,divLeftnew,divWidthnew,divHeightnew,docHeightnew,docWidthnew,objTimer,objTimernew,i = 0;
function getMsg()
{
try{
divTop = parseInt(document.getElementById("eMeng").style.top,10)
divLeft = parseInt(document.getElementById("eMeng").style.left,10)
divHeight = parseInt(document.getElementById("eMeng").offsetHeight,10)
divWidth = parseInt(document.getElementById("eMeng").offsetWidth,10)
docWidth = document.body.clientWidth;
docHeight = document.body.clientHeight;
document.getElementById("eMeng").style.top = parseInt(document.body.scrollTop,10) + docHeight + 10;// divHeight
document.getElementById("eMeng").style.left = 500
document.getElementById("eMeng").style.visibility="visible"divTopnew = parseInt(document.getElementById("eMengnew").style.top,10)
divLeftnew = parseInt(document.getElementById("eMengnew").style.left,10)
divHeightnew = parseInt(document.getElementById("eMengnew").offsetHeight,10)
divWidthnew = parseInt(document.getElementById("eMengnew").offsetWidth,10)
docWidthnew = document.body.clientWidth;
docHeightnew = document.body.clientHeight;
document.getElementById("eMengnew").style.top = parseInt(document.body.scrollTop,10) + docHeight + 10;// divHeight
document.getElementById("eMengnew").style.left = 500
document.getElementById("eMengnew").style.visibility="visible"objTimer = window.setInterval("moveDiv()",10)
}
catch(e){}
}function resizeDiv()
{
i+=1
if(i>1300) closeDiv() //客户想不用自动消失由用户来自己关闭所以屏蔽这句
try{
divHeight = parseInt(document.getElementById("eMeng").offsetHeight,10)
divWidth = parseInt(document.getElementById("eMeng").offsetWidth,10)
docWidth = document.body.clientWidth;
docHeight = document.body.clientHeight;
document.getElementById("eMeng").style.top = docHeight - divHeight + parseInt(document.body.scrollTop,10)-200
document.getElementById("eMeng").style.left = 500
}
catch(e){}
}
function resizeDivnew()
{
i+=1
if(i>1300) closeDiv() //客户想不用自动消失由用户来自己关闭所以屏蔽这句
try{
divHeightnew = parseInt(document.getElementById("eMengnew").offsetHeight,10)
divWidthnew = parseInt(document.getElementById("eMengnew").offsetWidth,10)
docWidthnew = document.body.clientWidth;
docHeightnew = document.body.clientHeight;
document.getElementById("eMengnew").style.top = docHeightnew - divHeightnew + parseInt(document.body.scrollTop,10)-80
document.getElementById("eMengnew").style.left = 500
}
catch(e){}
}function moveDiv()
{
try
{
if(parseInt(document.getElementById("eMeng").style.top,10) <= (docHeight - divHeight + parseInt(document.body.scrollTop,10)) -200)
{
window.clearInterval(objTimer)
objTimer = window.setInterval("resizeDiv()",1)
}
if(parseInt(document.getElementById("eMeng").style.top,10) <= (docHeight - divHeight + parseInt(document.body.scrollTop,10)))
{
objTimernew = window.setInterval("moveDivnew()",182)
}
divTop = parseInt(document.getElementById("eMeng").style.top,10)
document.getElementById("eMeng").style.top = divTop - 2
}
catch(e){}
}
function moveDivnew()
{
try
{
if(parseInt(document.getElementById("eMengnew").style.top,10) <= (docHeightnew - divHeightnew + parseInt(document.body.scrollTop,10)) -80)
{
widows.clearInterval(objTimernew)
objTimernew = window.setInterval("resizeDivnew()",1)
}
divTopnew = parseInt(document.getElementById("eMengnew").style.top,10)
document.getElementById("eMengnew").style.top = divTopnew - 1
}
catch(e){}
}
function closeDiv()
{
document.getElementById('eMeng').style.visibility='hidden';
if(objTimer) window.clearInterval(objTimer)
}
-->
</Script>
<DIV id=eMeng style="BORDER-RIGHT: #455690 1px solid; BORDER-TOP: #a6b4cf 1px solid; Z-INDEX:99999; LEFT: 0px; VISIBILITY: hidden; BORDER-LEFT: #a6b4cf 1px solid; WIDTH: 180px; BORDER-BOTTOM: #455690 1px solid; POSITION: absolute; TOP: 0px; HEIGHT: 116px; BACKGROUND-COLOR: #c9d3f3">
<TABLE style="BORDER-TOP: #ffffff 1px solid; BORDER-LEFT: #ffffff 1px solid" cellSpacing=0 cellPadding=0 width="100%" bgColor=#AFDCF3 border=0>
<TBODY>
<TR bgColor=#6699cc>
<TD style="font-size: 12px; background-image: url('images/msgTopBg.gif'); color: #0f2c8c" width=30 height=24></TD>
<TD style="font-weight: normal; font-size: 12px; background-image: url('images/msgTopBg.gif'); color: #ffffff; padding-left: 4px; padding-top: 4px" vAlign=center width="100%"><font color="red">最新公告</font></TD>
<TD style="background-image: url('images/msgTopBg.gif'); padding-right: 2px; padding-top: 2px" vAlign=center align=right width=19><span title=关闭 style="CURSOR: hand;color:white;font-size:12px;font-weight:bold;margin-right:4px;" onclick=closeDiv() >×</span></TD>
</TR>
<TR>
<TD style="background-image: url('UploadFiles/200510822587734.jpg'); padding-right: 1px; padding-bottom: 1px" colSpan=3 height=90>
<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: 18px; BORDER-BOTTOM: #b9c9ef 1px solid; HEIGHT: 100%">高晓松8日凌晨出狱身价暴涨<br>长寿药最快5年后问世<BR>
</DIV>
</TD>
</TR>
</TBODY>
</TABLE>
</DIV><DIV id=eMengnew style="BORDER-RIGHT: #455690 1px solid; BORDER-TOP: #a6b4cf 1px solid; Z-INDEX:99999; LEFT: 0px; VISIBILITY: hidden; BORDER-LEFT: #a6b4cf 1px solid; WIDTH: 180px; BORDER-BOTTOM: #455690 1px solid; POSITION: absolute; TOP: 0px; HEIGHT: 116px; BACKGROUND-COLOR: #c9d3f3">
<TABLE style="BORDER-TOP: #ffffff 1px solid; BORDER-LEFT: #ffffff 1px solid" cellSpacing=0 cellPadding=0 width="100%" bgColor=#AFDCF3 border=0>
<TBODY>
<TR bgColor=#6699cc>
<TD style="font-size: 12px; background-image: url('images/msgTopBg.gif'); color: #0f2c8c" width=30 height=24></TD>
<TD style="font-weight: normal; font-size: 12px; background-image: url('images/msgTopBg.gif'); color: #ffffff; padding-left: 4px; padding-top: 4px" vAlign=center width="100%"><font color="red">功能区域</font></TD>
<TD style="background-image: url('images/msgTopBg.gif'); padding-right: 2px; padding-top: 2px" vAlign=center align=right width=19><span title=关闭 style="CURSOR: hand;color:white;font-size:12px;font-weight:bold;margin-right:4px;" onclick=closeDiv() >×</span></TD>
</TR>
<TR>
<TD style="background-image: url('UploadFiles/200510822587734.jpg'); padding-right: 1px; padding-bottom: 1px" colSpan=3 height=90>
<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: 18px; BORDER-BOTTOM: #b9c9ef 1px solid; HEIGHT: 100%">待办文件<br>待阅文件<br>已办文件<br>已阅文件<BR>
</DIV>
</TD>
</TR>
</TBODY>
</TABLE>
</DIV>
</BODY>
</HTML>我的做法是先起了一个objTimer运行一个div,在objTimer控制的函数中又起了一个objTimernew,开始两个时钟设置的相同,但表示出来的效果不同,为什么呢?
function $(str){return(document.getElementById(str));}
在下面的函数里直接引用就好了
免得写那么多document.....
在看代码
等等
<html>
<head>
<title>移动DIV演示</title>
</head><BODY><Script language="javascript">
<!--
window.onload = getMsg;
window.onresize = resizeDiv;
window.onerror = function(){}var divTop,divLeft,divWidth,divHeight,docHeight,docWidth,divTopnew,divLeftnew,divWidthnew,divHeightnew,docHeightnew,docWidthnew,objTimer,objTimernew,i = 0;
function getMsg()
{
try{
divTop = parseInt(document.getElementById("eMeng").style.top,10)
divLeft = parseInt(document.getElementById("eMeng").style.left,10)
divHeight = parseInt(document.getElementById("eMeng").offsetHeight,10)
divWidth = parseInt(document.getElementById("eMeng").offsetWidth,10)
docWidth = document.body.clientWidth;
docHeight = document.body.clientHeight;
document.getElementById("eMeng").style.top = parseInt(document.body.scrollTop,10) + docHeight + 10;// divHeight
document.getElementById("eMeng").style.left = 500+"px";
document.getElementById("eMeng").style.visibility="visible"divTopnew = parseInt(document.getElementById("eMengnew").style.top,10)
divLeftnew = parseInt(document.getElementById("eMengnew").style.left,10)
divHeightnew = parseInt(document.getElementById("eMengnew").offsetHeight,10)
divWidthnew = parseInt(document.getElementById("eMengnew").offsetWidth,10)
docWidthnew = document.body.clientWidth;
docHeightnew = document.body.clientHeight;
document.getElementById("eMengnew").style.top = parseInt(document.body.scrollTop,10) + docHeight + 10;// divHeight
document.getElementById("eMengnew").style.left = 500+"px";
document.getElementById("eMengnew").style.visibility="visible"objTimer = window.setInterval("moveDiv()",10)
}
catch(e){}
}function resizeDiv()
{
i+=1
if(i>1300) closeDiv() //客户想不用自动消失由用户来自己关闭所以屏蔽这句
try{
divHeight = parseInt(document.getElementById("eMeng").offsetHeight,10)
divWidth = parseInt(document.getElementById("eMeng").offsetWidth,10)
docWidth = document.body.clientWidth;
docHeight = document.body.clientHeight;
document.getElementById("eMeng").style.top = docHeight - divHeight + parseInt(document.body.scrollTop,10)-200
document.getElementById("eMeng").style.left = 500
}
catch(e){}
}
function resizeDivnew()
{
i+=1
if(i>1300) closeDiv() //客户想不用自动消失由用户来自己关闭所以屏蔽这句
try{
divHeightnew = parseInt(document.getElementById("eMengnew").offsetHeight,10)
divWidthnew = parseInt(document.getElementById("eMengnew").offsetWidth,10)
docWidthnew = document.body.clientWidth;
docHeightnew = document.body.clientHeight;
document.getElementById("eMengnew").style.top = docHeightnew - divHeightnew + parseInt(document.body.scrollTop,10)-80
document.getElementById("eMengnew").style.left = 500
}
catch(e){}
}function moveDiv()
{
try
{
if(parseInt(document.getElementById("eMeng").style.top,10) <= (docHeight - divHeight + parseInt(document.body.scrollTop,10)) -200)
{
window.clearInterval(objTimer)
objTimer = window.setInterval("resizeDiv()",1)
}
if(parseInt(document.getElementById("eMeng").style.top,10) <= (docHeight - divHeight + parseInt(document.body.scrollTop,10)))
{
objTimernew = window.setInterval("moveDivnew()",182)
}
divTop = parseInt(document.getElementById("eMeng").style.top,10)
document.getElementById("eMeng").style.top = divTop - 2
}
catch(e){}
}
function moveDivnew()
{
try
{
if(parseInt(document.getElementById("eMengnew").style.top,10) <= (docHeightnew - divHeightnew + parseInt(document.body.scrollTop,10)) -80)
{
widows.clearInterval(objTimernew)
objTimernew = window.setInterval("resizeDivnew()",1)
}
divTopnew = parseInt(document.getElementById("eMengnew").style.top,10)
document.getElementById("eMengnew").style.top = divTopnew - 1
}
catch(e){}
}
function closeDiv()
{
document.getElementById('eMeng').style.visibility='hidden';
if(objTimer) window.clearInterval(objTimer)
}
-->
</Script>
<DIV id="eMeng" style="BORDER-RIGHT: #455690 1px solid; BORDER-TOP: #a6b4cf 1px solid; Z-INDEX:99999; LEFT: 0px; VISIBILITY: hidden; BORDER-LEFT: #a6b4cf 1px solid; WIDTH: 180px; BORDER-BOTTOM: #455690 1px solid; POSITION: absolute; TOP: 0px; HEIGHT: 116px; BACKGROUND-COLOR: #c9d3f3;">
<TABLE style="BORDER-TOP: #ffffff 1px solid; BORDER-LEFT: #ffffff 1px solid" cellSpacing=0 cellPadding=0 width="100%" bgColor=#AFDCF3 border=0>
<TBODY>
<TR bgColor=#6699cc>
<TD style="font-size: 12px; background-image: url('images/msgTopBg.gif'); color: #0f2c8c" width=30 height=24></TD>
<TD style="font-weight: normal; font-size: 12px; background-image: url('images/msgTopBg.gif'); color: #ffffff; padding-left: 4px; padding-top: 4px" vAlign=center width="100%"><font color="red">最新公告</font></TD>
<TD style="background-image: url('images/msgTopBg.gif'); padding-right: 2px; padding-top: 2px" vAlign=center align=right width=19><span title=关闭 style="CURSOR: hand;color:white;font-size:12px;font-weight:bold;margin-right:4px;" onclick=closeDiv() >×</span></TD>
</TR>
<TR>
<TD style="background-image: url('UploadFiles/200510822587734.jpg'); padding-right: 1px; padding-bottom: 1px" colSpan=3 height=90>
<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: 18px; BORDER-BOTTOM: #b9c9ef 1px solid; HEIGHT: 100%;">高晓松8日凌晨出狱身价暴涨<br>长寿药最快5年后问世<BR>
</DIV>
</TD>
</TR>
</TBODY>
</TABLE>
</DIV><DIV id="eMengnew" style="BORDER-RIGHT: #455690 1px solid; BORDER-TOP: #a6b4cf 1px solid; Z-INDEX:99999; LEFT: 0px; VISIBILITY: hidden; BORDER-LEFT: #a6b4cf 1px solid; WIDTH: 180px; BORDER-BOTTOM: #455690 1px solid; POSITION: absolute; TOP: 0px; HEIGHT: 116px; BACKGROUND-COLOR: #c9d3f3;">
<TABLE style="BORDER-TOP: #ffffff 1px solid; BORDER-LEFT: #ffffff 1px solid" cellSpacing=0 cellPadding=0 width="100%" bgColor=#AFDCF3 border=0>
<TBODY>
<TR bgColor=#6699cc>
<TD style="font-size: 12px; background-image: url('images/msgTopBg.gif'); color: #0f2c8c" width=30 height=24></TD>
<TD style="font-weight: normal; font-size: 12px; background-image: url('images/msgTopBg.gif'); color: #ffffff; padding-left: 4px; padding-top: 4px" vAlign=center width="100%"><font color="red">功能区域</font></TD>
<TD style="background-image: url('images/msgTopBg.gif'); padding-right: 2px; padding-top: 2px" vAlign=center align=right width=19><span title=关闭 style="CURSOR: hand;color:white;font-size:12px;font-weight:bold;margin-right:4px;" onclick=closeDiv() >×</span></TD>
</TR>
<TR>
<TD style="background-image: url('UploadFiles/200510822587734.jpg'); padding-right: 1px; padding-bottom: 1px" colSpan=3 height=90>
<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: 18px; BORDER-BOTTOM: #b9c9ef 1px solid; HEIGHT: 100%;">待办文件<br>待阅文件<br>已办文件<br>已阅文件<BR>
</DIV>
</TD>
</TR>
</TBODY>
</TABLE>
</DIV>
</BODY>
</HTML>
试试
看看这个是不是 你要的效果
<head>
<title>滑动DIV演示</title>
</head><BODY><Script language="javascript">
function getID(str){return(document.getElementById(str));}
<!--
window.onload = getMsg;
window.onresize = resizeDiv;var divTop,divLeft,divWidth,divHeight,docHeight,docWidth,divTopnew,divLeftnew,divWidthnew,divHeightnew,docHeightnew,docWidthnew,objTimer,objTimernew,i = 0;function getMsg()
{
try{
divTop = parseInt(getID("eMeng").style.top,10)
divLeft = parseInt(getID("eMeng").style.left,10)
divHeight = parseInt(getID("eMeng").offsetHeight,10)
divWidth = parseInt(getID("eMeng").offsetWidth,10)
docWidth = document.body.clientWidth;
docHeight = document.body.clientHeight;
getID("eMeng").style.top = parseInt(document.body.scrollTop,10) + docHeight + 10;
getID("eMeng").style.left = 500
getID("eMeng").style.visibility="visible"divTopnew = parseInt(getID("eMengnew").style.top,10)
divLeftnew = parseInt(getID("eMengnew").style.left,10)
divHeightnew = parseInt(getID("eMengnew").offsetHeight,10)
divWidthnew = parseInt(getID("eMengnew").offsetWidth,10)
docWidthnew = document.body.clientWidth;
docHeightnew = document.body.clientHeight;
getID("eMengnew").style.top = parseInt(document.body.scrollTop,10) + docHeight + 10;
getID("eMengnew").style.left = 500
getID("eMengnew").style.visibility="visible"objTimer = window.setInterval("moveDiv()",10)
}
catch(e){}
}function resizeDiv()
{
i+=1
if(i>1300) closeDiv() //客户想不用自动消失由用户来自己关闭所以屏蔽这句
try{
divHeight = parseInt(getID("eMeng").offsetHeight,10)
divWidth = parseInt(getID("eMeng").offsetWidth,10)
docWidth = document.body.clientWidth;
docHeight = document.body.clientHeight;
getID("eMeng").style.top = docHeight - divHeight + parseInt(document.body.scrollTop,10)-200
getID("eMeng").style.left = 500
}
catch(e){}
}function resizeDivnew()
{
i+=1
if(i>1300) closeDiv() //客户想不用自动消失由用户来自己关闭所以屏蔽这句
try{
divHeightnew = parseInt(getID("eMengnew").offsetHeight,10)
divWidthnew = parseInt(getID("eMengnew").offsetWidth,10)
docWidthnew = document.body.clientWidth;
docHeightnew = document.body.clientHeight;
getID("eMengnew").style.top = docHeightnew - divHeightnew + parseInt(document.body.scrollTop,10)-80
getID("eMengnew").style.left = 500
}
catch(e){}
}function moveDiv()
{
try
{
if(parseInt(getID("eMeng").style.top,10) <= (docHeight - divHeight + parseInt(document.body.scrollTop,10)) -200)
{
window.clearInterval(objTimer)
objTimer = window.setInterval("resizeDiv()",1)
}
if(parseInt(getID("eMeng").style.top,10) <= (docHeight - divHeight + parseInt(document.body.scrollTop,10)))
{
objTimernew = window.setInterval("moveDivnew()",10)
}
divTop = parseInt(getID("eMeng").style.top,10)
getID("eMeng").style.top = divTop - 1
}
catch(e){}
}function moveDivnew()
{
try
{
if(parseInt(getID("eMengnew").style.top,10) <= (docHeightnew - divHeightnew + parseInt(document.body.scrollTop,10)) -80)
{
widows.clearInterval(objTimernew)
objTimernew = window.setInterval("resizeDivnew()",1)
}
divTopnew = parseInt(getID("eMengnew").style.top,10)
getID("eMengnew").style.top = divTopnew - 1
}
catch(e){}
}
function closeDiv()
{
getID('eMeng').style.visibility='hidden';
if(objTimer) window.clearInterval(objTimer)
}
-->
</Script>
<DIV id=eMeng style="BORDER-RIGHT: #455690 1px solid; BORDER-TOP: #a6b4cf 1px solid; Z-INDEX:99999; LEFT: 0px; VISIBILITY: hidden; BORDER-LEFT: #a6b4cf 1px solid; WIDTH: 180px; BORDER-BOTTOM: #455690 1px solid; POSITION: absolute; TOP: 0px; HEIGHT: 116px; BACKGROUND-COLOR: #c9d3f3">
<TABLE style="BORDER-TOP: #ffffff 1px solid; BORDER-LEFT: #ffffff 1px solid" cellSpacing=0 cellPadding=0 width="100%" bgColor=#AFDCF3 border=0>
<TBODY>
<TR bgColor=#6699cc>
<TD style="font-size: 12px; background-image: url('images/msgTopBg.gif'); color: #0f2c8c" width=30 height=24></TD>
<TD style="font-weight: normal; font-size: 12px; background-image: url('images/msgTopBg.gif'); color: #ffffff; padding-left: 4px; padding-top: 4px" vAlign=center width="100%"><font color="red">最新公告</font></TD>
<TD style="background-image: url('images/msgTopBg.gif'); padding-right: 2px; padding-top: 2px" vAlign=center align=right width=19><span title=关闭 style="CURSOR: hand;color:white;font-size:12px;font-weight:bold;margin-right:4px;" onclick=closeDiv() >×</span></TD>
</TR>
<TR>
<TD style="background-image: url('UploadFiles/200510822587734.jpg'); padding-right: 1px; padding-bottom: 1px" colSpan=3 height=90>
<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: 18px; BORDER-BOTTOM: #b9c9ef 1px solid; HEIGHT: 100%">高晓松8日凌晨出狱身价暴涨<br>长寿药最快5年后问世<BR>
</DIV>
</TD>
</TR>
</TBODY>
</TABLE>
</DIV><DIV id=eMengnew style="BORDER-RIGHT: #455690 1px solid; BORDER-TOP: #a6b4cf 1px solid; Z-INDEX:99999; LEFT: 0px; VISIBILITY: hidden; BORDER-LEFT: #a6b4cf 1px solid; WIDTH: 180px; BORDER-BOTTOM: #455690 1px solid; POSITION: absolute; TOP: 0px; HEIGHT: 116px; BACKGROUND-COLOR: #c9d3f3">
<TABLE style="BORDER-TOP: #ffffff 1px solid; BORDER-LEFT: #ffffff 1px solid" cellSpacing=0 cellPadding=0 width="100%" bgColor=#AFDCF3 border=0>
<TBODY>
<TR bgColor=#6699cc>
<TD style="font-size: 12px; background-image: url('images/msgTopBg.gif'); color: #0f2c8c" width=30 height=24></TD>
<TD style="font-weight: normal; font-size: 12px; background-image: url('images/msgTopBg.gif'); color: #ffffff; padding-left: 4px; padding-top: 4px" vAlign=center width="100%"><font color="red">功能区域</font></TD>
<TD style="background-image: url('images/msgTopBg.gif'); padding-right: 2px; padding-top: 2px" vAlign=center align=right width=19><span title=关闭 style="CURSOR: hand;color:white;font-size:12px;font-weight:bold;margin-right:4px;" onclick=closeDiv() >×</span></TD>
</TR>
<TR>
<TD style="background-image: url('UploadFiles/200510822587734.jpg'); padding-right: 1px; padding-bottom: 1px" colSpan=3 height=90>
<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: 18px; BORDER-BOTTOM: #b9c9ef 1px solid; HEIGHT: 100%">待办文件<br>待阅文件<br>已办文件<br>已阅文件<BR>
</DIV>
</TD>
</TR>
</TBODY>
</TABLE>
</DIV>
</BODY>
</HTML>
objTimer = window.setInterval("moveDiv()",10)function moveDiv()
{
try
{
if(parseInt(document.getElementById("eMeng").style.top,10) <= (docHeight - divHeight + parseInt(document.body.scrollTop,10)) -200)
{
window.clearInterval(objTimer)
objTimer = window.setInterval("resizeDiv()",1)
}
if(parseInt(document.getElementById("eMeng").style.top,10) <= (docHeight - divHeight + parseInt(document.body.scrollTop,10)))
{
objTimernew = window.setInterval("moveDivnew()",10)
}
divTop = parseInt(document.getElementById("eMeng").style.top,10)
document.getElementById("eMeng").style.top = divTop - 1
}
catch(e){}
}
function moveDivnew()
{
try
{
if(parseInt(document.getElementById("eMengnew").style.top,10) <= (docHeightnew - divHeightnew + parseInt(document.body.scrollTop,10)) -80)
{
widows.clearInterval(objTimernew)
objTimernew = window.setInterval("resizeDivnew()",1)
}
divTopnew = parseInt(document.getElementById("eMengnew").style.top,10)
document.getElementById("eMengnew").style.top = divTopnew - 1
}
catch(e){}
}
<script type="text/javascript">
function a()
{
var n=document.getElementById("show1");
if(parseInt(n.style.top)>300)
{
n.style.top=parseInt(n.style.top)-1+"px";
}
if(parseInt(n.style.top)<400)
b();
t=setTimeout('a()',10);
}
function b()
{
var n=document.getElementById("show2");
if(parseInt(n.style.top)>300)
n.style.top=parseInt(n.style.top)-1+"px";
}
</script>
<body bgcolor="#669900" onLoad="a()">
<div id="show1" style="width:100px; height:75px; background-color:#FF00FF; position:absolute;left:600px; top:500px; border:#000000 1px solid; display:inline;"></div>
<div id="show2" style="width:100px; height:75px; background-color:#333333; position:absolute;left:600px; top:500px; border:#000000 1px solid; display:inline;"></div>
</body>下午在上课
刚才才考完试回来
这个没做判断 你可以去改改 不知道是不是你要的效果
从中得出结论:昨天我debug了一下,发现时钟(两个时钟设置一样间隔)嵌套,运行起来,两个div速度就不一样了,被嵌套的那个描画要快好多。
多谢帮助!!
你说的是flash?