滚动广告效果: <%@page contentType="text/html; charset=utf-8"%> <form name="vendors"> <table width="950" height="76" background="/images/090716_index/partner_bg.jpg" cellspacing="0" cellpadding="0" style="font-size: 12px;"> <tr οnmοuseοut="startV();" οnmοuseοver="stopV();"> <td width="18"> <img src="/images/090716_index/partner_left_btn.jpg" border="0" style="cursor: pointer;" οnclick="previous();"> </td> <td width="888" align="center"> <div id="outDemo" style="width: 888px;overflow: hidden;"> <div id = "innDemo" style="width: <%=divWidth %>px;"> <div name="vendor" id="<%=tagID%>" style="<%=relStyle %>"> <img src="<%=filePath%>" border="0" style="width: 137px; height: 60px;" /> </div> </div> </div> </td> <td width="18"> <img src="/images/090716_index/partner_right_btn.jpg" border="0" style="cursor: pointer;" οnclick="next();"> </td> </tr> </table> </form> <script type="text/javascript"> /*******************/ var timer = ""; var interval = 20; var cellWidth = 149; var padding = 10; var demo = document.getElementById("outDemo"); var demo1 = document.getElementById("innDemo"); var resetLeft = 745; var paddingLeft = parseInt(demo1.style.width) - parseInt(demo.style.width) - padding; demo1.innerHTML += demo1.innerHTML; function stopV(){ if("" != timer){ clearInterval(timer); timer=""; } } function startV(){ if("" == timer){ go(); } } function move(){ demo.scrollLeft = demo.scrollLeft==paddingLeft?resetLeft:demo.scrollLeft+1; } function go(){ timer = setInterval(move,interval); } function next() { var x = demo.scrollLeft%cellWidth != 0 ? parseInt(demo.scrollLeft/cellWidth)+1 : parseInt(demo.scrollLeft/cellWidth); demo.scrollLeft = demo.scrollLeft>paddingLeft?1:(x*cellWidth)+padding; } function previous() { var y = demo.scrollLeft%cellWidth != 0 ? parseInt(demo.scrollLeft/cellWidth) : parseInt(demo.scrollLeft/cellWidth)-1; demo.scrollLeft = demo.scrollLeft<1?paddingLeft:(y*cellWidth); } window.onload = go; /*******************/ </script>
Css 选项卡:
添加收藏 和 设为首页:
|