返回列表 发帖

网页之跑马灯文字特效

//修改宽度
% a9 |9 k) `! C7 F( x* w$ Y: O- B7 Tvar marqueewidth=300
8 s5 ~/ E: s0 ?) H//高度
$ g- v7 A1 Y- U& |4 I1 P. F1 Q* Mvar marqueeheight=252 k8 O: w  |4 _$ s
//速度(1-10)
, j! E/ M" C' C5 l# W' I# R/ Xvar marqueespeed=32 A! c5 N' Y& C$ h, h& V
//背景颜色  J6 c% Z1 r6 H1 T
var marqueebgcolor="#FFFFFF"
0 G/ d) f  Y8 j( f% T, p$ e' v//是否能暂停 (0=no. 1=yes)?; [2 ?4 b- R1 j( d
var pauseit=1
. l& m3 o0 A- e$ m% d0 H+ n5 v- }0 N% Z% R& |# H
//修改显示内容
! {+ M+ f- v: i6 y" M" F+ ^. jvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'/ {, k1 d( y/ g

# f7 p9 b6 ~! w; z1 B! F
/ l- n9 T7 e+ Q  l6 _. p////下面不需改变////////////9 Z- k  H  `* b  O9 E0 z% u0 d' v

* q7 T6 X1 I: c' _6 Yvar copyspeed=marqueespeed
& h  ~3 ?# `, \' K! H1 Lvar pausespeed=(pauseit==0)? copyspeed: 01 ]  B, m+ Q# I* P/ ^
var iedom=document.all||document.getElementById
+ E6 d' t  u0 _: l  _if (iedom)
+ \* b1 k' o6 N" h/ b! Y0 Z5 Ndocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')9 f( F1 P& W: K( G" `; N. x
var actualwidth=''+ y; n2 v2 N: k. z- P
var cross_marquee, ns_marquee/ f+ s0 P2 m* M

) j0 @, `3 e, Q3 J0 G. ~$ {# Vfunction populate(){
! D& {5 t6 ?) G* V$ Pif (iedom){
- ]1 B/ K9 y4 Y; b( a! S+ i! Jcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
5 e* s$ g$ ]- C0 xcross_marquee.style.left=marqueewidth+83 G: [; N$ l  F( D: b9 ]
cross_marquee.innerHTML=marqueecontent' C! A/ e3 p3 e$ k
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
+ J$ }! z8 [! _3 A+ R9 K/ @}5 h2 ^( e+ K" [5 m
else if (document.layers){
0 ^  d2 K' g( O6 p- J# s# Hns_marquee=document.ns_marquee.document.ns_marquee2  \7 R7 S. ?4 c5 X' j: Z( R/ p
ns_marquee.left=marqueewidth+82 N+ q% Z) R/ f* A& w) |& e' z
ns_marquee.document.write(marqueecontent)
  j! n$ E8 G# m' V- ?ns_marquee.document.close()
' F& N& ]2 ^3 mactualwidth=ns_marquee.document.width
9 X4 I1 n" O* e( @- j/ N! D}& \4 S5 j; G/ W* D* w
lefttime=setInterval("scrollmarquee()",20)  ~) r3 \. X1 L5 N) h) D+ E6 z5 g
}
9 D; U( M/ u4 H& D7 C, J3 D8 v2 twindow.onload=populate
, n" l" O3 B2 Z! I  R' J& k8 r& {0 W  M% V1 K' B0 v2 ]/ K
function scrollmarquee(){. l! j8 k' t9 C8 {, ]
if (iedom){# T& i0 m* `" _0 N$ x. w
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))) m0 o6 N2 B) X9 U! I0 {' W% ?
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed8 R6 K1 g/ F$ M6 B* }- O
else
8 P/ x$ W1 o, m. W3 ucross_marquee.style.left=marqueewidth+8
$ p8 R  ?4 j& y6 L# c# }9 g
! D7 S3 y/ s% V& ]- U& d}# S8 c) E7 W  [! b5 j5 \
else if (document.layers){/ U, _$ \& K! L. I
if (ns_marquee.left>(actualwidth*(-1)+8))
8 d( G, I, m* ?. m2 B2 u# X1 Gns_marquee.left-=copyspeed
: f( v4 X" \- C# yelse
' u) b# X+ m# |1 o0 c2 i; Yns_marquee.left=marqueewidth+8
: _9 X# _8 |5 N8 w6 J# ^}# L: m! u' N* \3 F9 K2 i6 {
}' e2 }$ `7 f( K$ N1 }
$ d1 Q9 A  C# Q* S2 W. M& ^; W$ k& f
if (iedom||document.layers){
; c* e* N* F+ Awith (document){
) r$ m& _8 x- u& K+ qdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
. |# G" l$ e2 g$ U! cif (iedom){
+ m8 ?) S5 q5 \write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
+ R3 i0 G- v) p* m  d3 i# wwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
3 m/ r; {% \3 k; g4 mwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
3 w' M4 {. }! d* _: K9 I0 xwrite('</div>')3 d0 V2 l% N, i: u' a% Y
}
' c2 y5 l+ \" N+ d, b9 Qelse if (document.layers){
( T& ^- i. l, b1 L3 A5 jwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
# H( j' \+ K+ ?7 C& Zwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
: J4 H9 O% j; ~" M% Twrite('</ilayer>')- Z5 H! q  H9 z! D9 l0 g6 F
}6 y$ e4 i- n0 ?1 c/ u% g$ K" w
document.write('</td></table>')( K+ r' c+ d% R. C* Q
}% n7 M" d; K# K* h# R+ q0 v
}( p) ?8 C6 t, y" f% e" X
</script>

返回列表
【捌玖网络】已经运行: