|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度
) @4 s- L5 a, I# A" F$ rvar marqueewidth=300
3 o+ s I. s* o6 V, @1 b* ~ X//高度4 I1 {( z1 y4 Y z6 ]- ^3 r5 }9 f
var marqueeheight=25! u+ H; H0 I; q% ?& S, y, P
//速度(1-10)( T8 ], @9 S2 G6 P( k: [; u
var marqueespeed=3, s) p- e0 v1 K: k2 y8 G3 B% w
//背景颜色
) W/ L' Q: U2 O! K& t9 a) T6 r9 @9 bvar marqueebgcolor="#FFFFFF"
% e. B* [* i' j//是否能暂停 (0=no. 1=yes)?( R3 R: C# C( A7 f' a4 L/ e& S
var pauseit=15 J2 f+ M/ e+ `/ |- W7 h& d
, ^4 J3 P# p. z% c
//修改显示内容
% `& |2 j" M( r3 Z# Q5 P, y1 kvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>' p! U. w+ I* W% q
! ^0 ]" \5 p" a$ n1 y% g. a9 Z1 X; i% `* ~& L- v
////下面不需改变////////////
1 ^$ H4 i3 Y5 f J
- G/ t+ T% o# Y& Z/ J* w6 V9 cvar copyspeed=marqueespeed$ H' o9 n5 @2 Y, |4 o: ]; ?6 Y. ^
var pausespeed=(pauseit==0)? copyspeed: 0
% P% ^5 _3 V/ c7 Q4 _* `% hvar iedom=document.all||document.getElementById/ F q+ d& ]/ H1 A7 o
if (iedom)
7 v2 `0 N% k5 @2 b6 Y0 y1 f9 bdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
; C) R) s: e. _3 U; |var actualwidth=''* b2 D7 W: Z! N, ]" N j
var cross_marquee, ns_marquee T6 ]/ h8 I3 E9 ~: X9 w" ]" V+ V
- R# q/ w; w8 Jfunction populate(){* j6 H5 ^# A# ^
if (iedom){
0 E( M; O( f1 l( @6 E8 l3 k. x- K3 ucross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee p g0 F8 {/ \5 ^
cross_marquee.style.left=marqueewidth+8
: I) a$ i8 H* n. Y$ Hcross_marquee.innerHTML=marqueecontent
- [$ \! }% ~; \3 f5 q# _actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
; y+ m& A; L4 X: \$ l$ o, V}
' r+ i7 V" u: F- _; c) c6 Yelse if (document.layers){
! D+ L$ \4 y, n/ uns_marquee=document.ns_marquee.document.ns_marquee2
* d$ J& g. c" U6 |1 wns_marquee.left=marqueewidth+84 F8 C+ R" }! i q, ]: {) u
ns_marquee.document.write(marqueecontent)7 T0 n* v" v! G$ X
ns_marquee.document.close()
" t) J" T# C @$ Pactualwidth=ns_marquee.document.width
) I% }& k# k$ m& O6 k) R* |}
0 E4 |5 v% @6 Rlefttime=setInterval("scrollmarquee()",20)
$ `) Q! u! ~- }9 A% P2 {& a4 F}( X7 F9 v0 Z' H+ Y) y7 [6 A- n. A( Z
window.onload=populate5 Y; l% k8 `* f: g# }$ [. D$ s
; ]+ w- O ~4 F' B" L# H* f% Zfunction scrollmarquee(){+ o- A# z7 f' q$ B& m
if (iedom){2 w: ?4 Y1 R- G8 @$ Z- {6 V I
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
/ |% J( J% C7 Fcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
! A4 S& m' u5 Y: a5 welse
1 {% v0 v2 g/ y0 s, dcross_marquee.style.left=marqueewidth+8
! ~3 `6 A5 L5 e8 V# E
3 Q/ |. y( }8 }}
0 }) ?. {. s- ~$ nelse if (document.layers){
$ @! _! w4 e" x) ^5 t) A5 |if (ns_marquee.left>(actualwidth*(-1)+8))
' \1 v& W& i. l, Mns_marquee.left-=copyspeed
4 ~. _$ ]+ Q, n& z; g& \else
k3 d! [7 p n) dns_marquee.left=marqueewidth+8
! B9 |# n& L1 }4 g& K}& E) C, n2 t- Q; i" ^$ A: |
}
. P9 u9 C: q( U: i4 _# Z, j1 q9 q& t- z3 k3 q, D8 Z
if (iedom||document.layers){
2 \1 @5 `5 J6 l0 fwith (document){
. X1 m2 b; D& Q2 J2 v7 `7 zdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'): ?6 b: @7 q1 X8 b% m" M' `2 ^4 `$ @' p
if (iedom){. z% R" B: d: V
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
, F9 p4 }9 X3 c- M3 rwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
l5 C9 T, I2 C B( d" a* Rwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'). r" y7 ~1 E" `& v, S
write('</div>')
) E |1 O7 g4 ?: U* o; T: q}! f; x5 o" }$ N, O3 c6 D, v
else if (document.layers){
+ V/ F. ~7 V# a1 H3 iwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')7 ]- ]! o( p, N1 ]
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
7 {0 k! g/ e/ M% b2 }6 M% L, nwrite('</ilayer>')% Q# j2 |0 {, s8 s# H- k0 Q" P+ p
}2 u) Y# K3 m, k* o. A* e$ Y# h' Q) c
document.write('</td></table>')0 H: I* q( A' J1 } t
}3 h, T4 c) y% Q4 J) ]
}
* }1 P5 P9 a: |- r H2 b</script> |
|