脚本特效展示
文本从右向左输出
注意:把< body>中的内容改为: < body bgcolor="#fef4d9" onload="tickinit()">
doesn't this message scroller look great? you can even insert links like this:
yahoo.com
now it repeats.
以下代码加入<head>区域
<script language="javascript1.2"> <!-- begin var l1 = 0; // left of ticker in pixel, or 0 to position relative var t1 = 0; // top of ticker in pixel, or 0 to position relative var w1 = 400; // width of ticker in pixel var ie = document.all ? true : false; var first = true; var l2 = l1 + w1; var l3 = l1 - l2; var l = l2; function tickinit() { if (ie) { if (l1 == 0 && t1 == 0) { pos = document.all['tickpos']; l1 = getleft(pos); t1 = gettop(pos); } ticktext.style.postop = t1; } else { if (l1 == 0 && t1 == 0) { pos = document.anchors['tickpos']; l1 = pos.x; t1 = pos.y; } document.ticktext.pagey = t1; } l2 = l1 + w1; l3 = l1 - l2; l = l2; setinterval('tick()', 10); } function getleft(ll) { if (ll.offsetparent) return (ll.offsetleft + getleft(ll.offsetparent)); else return (ll.offsetleft); } function gettop(ll) { if (ll.offsetparent) return (ll.offsettop + gettop(ll.offsetparent)); else return (ll.offsettop); } function tick() { l = l - 0.5; if (l < l3) l = l2; cl = l1 - l; cr = l2 - l; if (ie) { ticktext.style.posleft = l; ticktext.style.postop = t1; ticktext.style.clip = "rect(auto "+cr+"px auto "+cl+"px)"; if (first) ticktext.style.visibility = "visible"; } else { document.ticktext.pagex = l; document.ticktext.clip.left = cl; document.ticktext.clip.right = cr; if (first) document.ticktext.visibility = "show"; } first = false; } // end --> </script>
以下代码加入<body>区域