<!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>左右侧随滚动条实例js代码</title> </head> <body> <div style="500px;height:500px"></div> <SCRIPT LANGUAGE="JavaScript"> <!-- function jMsg() { } jMsg.prototype.msgDIV = function() { //动态计算浮动滚动条的位置 lastScrollY = 0; var beat = function() { var diffY; if (document.documentElement && document.documentElement.scrollTop) diffY = document.documentElement.scrollTop; else if (document.body) diffY = document.body.scrollTop else { /*Netscape stuff*/ } percent = .1 * (diffY - lastScrollY); if (percent > 0) percent = Math.ceil(percent); else percent = Math.floor(percent); document.getElementById("msgDiv").style.top = parseInt(document.getElementById("msgDiv").style.top) + percent + "px"; lastScrollY = lastScrollY + percent; } msgDivCode = "<div id="msgDiv" style='text-align:center; 114px; height:126px;background:url(../images/logo1.png) no-repeat;z-index:2010; right:15px; top:520px; position:absolute; padding:100px 0px 0 2px; '></div>"; document.write(msgDivCode); window.setInterval(beat, 120); } jMsg.prototype.msgDIVleft = function() { //动态计算浮动滚动条的位置 lastScrollY = 0; var beat = function() { var diffY; if (document.documentElement && document.documentElement.scrollTop) diffY = document.documentElement.scrollTop; else if (document.body) diffY = document.body.scrollTop else { /*Netscape stuff*/ } percent = .1 * (diffY - lastScrollY); if (percent > 0) percent = Math.ceil(percent); else percent = Math.floor(percent); document.getElementById("msgDivleft").style.top = parseInt(document.getElementById("msgDivleft").style.top) + percent + "px"; lastScrollY = lastScrollY + percent; } msgDivCode = "<div id="msgDivleft" style='text-align:center; 109px; height:430px;z-index:2010; left:15px; top:150px; position:absolute; '><div style='poaition:relative;'><a href='http://jinyuan900.hrbacq.com/index.asp' target='_blank'><img src='images/jy.jpg' border=1/></a><a class='close' onclick=closed() style='position:absolute;right:0px;top:0px;39px;height:23px;z-index:200000;font-size:12px;display:block;cursor:pointer;'> </a></div></div>"; <!--在这里把img外层有一层a标签,需要在图片上点击,这时候需要定位知识, 这里原来的结构是 div-a -img /a /div 现在在div-a-div1 img /a div2 /div2 /div1 /div--> <!--让div1设定为position:relative; div2:position:absolute;这样可以在这个图片上哪个位置都可以放置div2了,只要设定div2的位置-->
document.write(msgDivCode); window.setInterval(beat, 120); } var $jMsg = new jMsg(); $jMsg.msgDIV(); $jMsg.msgDIVleft(); //--> </SCRIPT> <script type="text/javascript"> function closed() { var aaa=document.getElementById("msgDivleft"); aaa.style.display="none"; } </script> </body> </html>
今天因为这个,又一次被 说了,每一次从头开始都是那么艰难,但是心里一直坚持“苦其自身,掌声雷动”
每个人都有每个人自己的想法,我不知道有经验的人都这样吗?
成熟的麦子都是低着头的,只有生的麦子才朝天。
今天自己走在大街上,心里很不好受,何苦呢?
其实是给自己一个机会
难道我看起来非常讨厌吗?好吧,顺其自然吧,如果离开了,也没有什么遗憾,因为自己曾经努力过、奋斗过、煎熬过、忍耐过