武林外史米雪版结局:请教一个网页的特效

来源:百度文库 编辑:高校问答 时间:2024/04/27 16:54:29
类似于qq的在线状态或者购物车或者广告的形式,一个对象固定在网页的某个区域,上下拖动网页滚动条都不会影响他的位置。是不是用javascript实现啊?能不能用具体的代码给我讲讲?回答得好我再给加分,谢谢。

放到</head>和<body>中间
<script language=javascript>function close163news(){searchspe.style.visibility='hidden';searchspe2.style.visibility='hidden';} var specialcode="<DIV id=searchspe style='Z-INDEX: 100; right: 1px; POSITION: absolute; TOP: 30px;'><TABLE cellSpacing=0 cellPadding=0 width=150 style='font-size:12px;color:#ffffff'><TR bgcolor=#C54A00><TD height=20> 推荐↓</TD><TD style='CURSOR: hand' onclick='close163news()' width=30>关 闭</TD></TR></TABLE>这里放入代码</DIV>";document.write(specialcode);lastScrollX=0;function heartBeat0(){diffY=document.body.scrollTop;percent=.1*(diffY-lastScrollX);if(percent>0)percent=Math.ceil(percent);else percent=Math.floor(percent);document.all.searchspe.style.pixelTop+=percent;lastScrollX=lastScrollX+percent;}window.setInterval("heartBeat0()",1);var specialcode2="<DIV id=searchspe2 style='Z-INDEX: 100; left: 1px; POSITION: absolute; TOP: 30px;'><TABLE cellSpacing=0 cellPadding=0 width=150 style='font-size:12px;color:#ffffff'><TR bgcolor=#12BDFF><TD height=20> 推荐↓</TD><TD style='CURSOR: hand' onclick='close163news()' width=30>关 闭</TD></TR></TABLE>这里放入代码</DIV>";document.write(specialcode2);lastScrollY=0;function heartBeat1(){diffY=document.body.scrollTop;percent=.1*(diffY-lastScrollY);if(percent>0)percent=Math.ceil(percent);else percent=Math.floor(percent);document.all.searchspe2.style.pixelTop+=percent;lastScrollY=lastScrollY+percent;}window.setInterval("heartBeat1()",1);</script>