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

|
网页之跑马灯文字特效
//修改宽度0 ^% v' h; x* q8 j7 i
var marqueewidth=3005 D+ i/ Q: d3 ~3 n; ]% C0 Y
//高度
4 _4 k0 A" b8 \" S! Nvar marqueeheight=25
7 d3 L4 \5 ^' ^5 ]2 Y7 j/ T& o//速度(1-10)
, Q5 y: d9 g) K. `' ^1 a& q" \var marqueespeed=3
/ ^+ l4 X1 j, K; H$ q5 Y//背景颜色
, g8 Y1 q2 p8 o7 |1 w& kvar marqueebgcolor="#FFFFFF"/ c. }7 |4 u1 @( @% Y
//是否能暂停 (0=no. 1=yes)?4 {% x/ X7 u z$ O
var pauseit=1
2 W* j. |' s- d% d* O5 p4 H% ^
" b$ z- Y* u9 D4 Y" I, k//修改显示内容( k2 ^% U' u! C: E
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'8 C6 N: }% t) C' f; `/ r% A+ M" g
: a0 ?" t+ v* G7 d+ q1 Q' {9 N k% A8 @. Y9 N# `, P! x
////下面不需改变////////////
3 a1 c- {/ C, W' x5 j/ R- Q& H5 F5 k3 n2 _+ C( R
var copyspeed=marqueespeed1 h, d0 Q/ s2 o2 \) X" E+ z
var pausespeed=(pauseit==0)? copyspeed: 0( O6 R1 m- a: b ^: U; |
var iedom=document.all||document.getElementById
# X7 z' {/ ~/ w0 k: p" P4 Rif (iedom)
, e, f1 D( |8 K0 R8 [document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
, g/ N9 J- n0 }0 G8 `2 vvar actualwidth=''
4 G4 y% p/ K Zvar cross_marquee, ns_marquee
" z1 N0 b, J/ E" |: e" J
/ U% K3 L7 r& f/ m. i# B: nfunction populate(){
& h* f) T- K8 m9 _5 W/ R+ eif (iedom){
2 H8 s0 q" [: I8 N$ b2 }, B- across_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee* Y9 ]: ?3 a# R; I) n* D
cross_marquee.style.left=marqueewidth+8. P, E) q& p, r+ L6 u' o
cross_marquee.innerHTML=marqueecontent
: d- D" Z5 F" D: Factualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
' E; p% O9 `' p2 n8 c9 o}
) c, o' k. O$ I" a9 belse if (document.layers){
5 U5 y6 u# a3 O* Ins_marquee=document.ns_marquee.document.ns_marquee2
/ e& ?; z0 j6 L% cns_marquee.left=marqueewidth+8# N+ A- b! h) i
ns_marquee.document.write(marqueecontent)
% @1 T2 p7 E- v; Yns_marquee.document.close()
1 @2 H' ?7 B3 `7 C4 ] H$ T) d( Aactualwidth=ns_marquee.document.width
5 t+ c" p, P# B. A9 g! K}
' b" b5 N" q3 ?" T$ |; plefttime=setInterval("scrollmarquee()",20)
0 S* {& V8 t) i: A# b! v}
2 f E" R1 d. D7 f# O: v$ d" Cwindow.onload=populate
; T- w- x3 ^5 ]3 P# i' F
H( l: S+ t$ r2 B6 p2 ~& Lfunction scrollmarquee(){
( z! f+ C2 _: H: H3 D- x2 c3 Kif (iedom){
: N" p/ b, r+ z* b% r2 H* F% cif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
; E% v1 f+ |7 M9 L( gcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
+ ^1 N) g& F4 D* }' c( welse- ~$ r* _8 ^) ^& ?, O9 Q w
cross_marquee.style.left=marqueewidth+8 G! S' m t6 u6 {1 N4 I8 b5 s/ r
: g* F8 B' w7 k; g' a3 l
}4 E* E1 s7 F* R$ W- ~" c* g: b
else if (document.layers){1 {/ o' Q) G. r9 K2 F# j
if (ns_marquee.left>(actualwidth*(-1)+8))
% A: M/ _0 L4 X! _2 F# q4 d" C* Wns_marquee.left-=copyspeed* `! B' P$ G. y7 l g
else; I; J- o% U+ W- m+ t
ns_marquee.left=marqueewidth+86 I2 d& ]' t% J0 l& Q- C
} ^/ K" U# s( Y3 Y. N
}
3 M, J* E$ Z$ o, n; x' _
9 _0 I. n4 Z% M0 Cif (iedom||document.layers){
4 I2 W# T/ M7 }! s1 V, [' wwith (document){
3 x" b+ w' L, Y" tdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')+ Z: F# O' M. G7 }3 \7 a2 l
if (iedom){
$ y" H' i0 J' M9 U: i1 W( V" {' dwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
. Y1 t+ ]/ m6 ^: n3 m' I2 i- k Vwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
( F$ x/ A" d% U/ D0 ]write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')* L- k i% Z z2 U
write('</div>')) j2 g- k; s$ E# I& M Y( _
}
1 Y3 c- z9 o y9 C+ U" j& X a5 [& eelse if (document.layers){
. c1 J9 \% | Uwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
/ B0 q8 T* |0 C `" K& o! ~9 ]write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')% p, p$ [* Z/ }, u9 R0 r% O
write('</ilayer>'); ^: L% R# a T7 h- |3 y
}' o; j, ]( ]9 ]3 S; |6 g9 }
document.write('</td></table>')
6 D8 O( \6 I, }* B4 I+ C}
0 m7 H& B0 l, n}
% l$ v2 I0 H/ `. P/ ]' [</script> |
|