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

|
网页之跑马灯文字特效
//修改宽度- Z2 q8 p! X& w9 D
var marqueewidth=300
1 y. M. P3 B5 D. h1 u, {9 E. I//高度9 R8 U# n1 B- l1 @9 `* `( V/ {8 w
var marqueeheight=25
- W- V/ k; x# ?# B//速度(1-10)
- Y; @' [- Q# Z1 o, c3 F8 i0 t! Kvar marqueespeed=36 {2 z/ k* y& ]8 u0 E |
//背景颜色
1 T5 G, T- Y* n Avar marqueebgcolor="#FFFFFF"
! A- n" ^5 \ N7 N0 N4 S/ D5 d/ g//是否能暂停 (0=no. 1=yes)?
4 {0 M+ u V6 q2 B+ \1 mvar pauseit=14 z$ U( N$ d: I
" j: C2 X- ^# N3 x2 `+ t7 E//修改显示内容
& z6 j/ E. ]) F/ uvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
, b/ [$ n1 C1 d7 z7 M4 o
) A9 [. w* F9 R$ n- M7 C4 N$ i
9 T: i2 f8 L) f) D' G////下面不需改变////////////3 ^0 k' O; D" l" g- G
) t/ n0 P+ ^) r6 G$ lvar copyspeed=marqueespeed
) V% g( U4 e B6 v/ Q* ^/ {: J5 kvar pausespeed=(pauseit==0)? copyspeed: 0
8 N9 c$ U2 r& r# gvar iedom=document.all||document.getElementById/ _' f Q3 C: t$ u B& @% |6 f5 \
if (iedom)
2 t4 E6 `5 e/ E: P; ?- z) e( \document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
6 Z$ Z4 }" H* K2 @7 Y X7 fvar actualwidth=''
( J& O; x% h1 j8 h# s7 Xvar cross_marquee, ns_marquee( ^: F- O) g' k) V9 G
9 Z4 D. b4 C& [ T/ x- L4 T2 @function populate(){
3 p& X* `, K, P1 \4 W2 p0 f: V5 Wif (iedom){3 d+ [; I5 y' ]! k: \0 O$ [0 k* I
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
6 H4 @" y4 c) K# \cross_marquee.style.left=marqueewidth+83 U/ a* C# l' w( w7 F
cross_marquee.innerHTML=marqueecontent
( f4 o6 ^; @' d8 o3 y9 s" H: Xactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
& H" A( w0 }# N+ t! F}6 u7 c1 t1 Z+ X$ k0 F4 ~2 D
else if (document.layers){) C1 S" ?8 [ L- R- A, x3 |% A6 o8 B* ?
ns_marquee=document.ns_marquee.document.ns_marquee2* m& s; q7 u- x/ y
ns_marquee.left=marqueewidth+8* x* V2 w1 d. g. l5 O% C
ns_marquee.document.write(marqueecontent)
' I, P! L1 W3 G7 E) Q$ gns_marquee.document.close()
. G# V5 M9 A; t; Eactualwidth=ns_marquee.document.width
8 N: `9 \3 a5 s+ F) K3 {}
# X$ t0 {+ i8 W$ s3 _lefttime=setInterval("scrollmarquee()",20)8 P4 N9 g' ?8 F6 f- N9 u0 ~
}& K" n" _% L8 d$ L1 t+ I" p$ b
window.onload=populate' s7 u& ^9 J0 I( ]1 m, h5 U: r' h% v5 ^
, n! [, m, y& O& d1 b
function scrollmarquee(){, U& U: N( h/ w/ g
if (iedom){% |8 P6 Y% E2 S( b% B( H1 n- Z' T; r* Q1 U
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
8 Y _" ]# E+ l* i1 Lcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
1 T# [) F7 f3 P9 n8 J7 i/ ~4 Eelse
/ i7 n7 v+ M/ Y. z$ tcross_marquee.style.left=marqueewidth+8
, A$ G- l2 Z; i, R! D, m: |" m4 \( F1 f
}
* d# T2 ?' i7 r- l3 Melse if (document.layers){
) T6 K o/ a1 C4 S8 v9 lif (ns_marquee.left>(actualwidth*(-1)+8))7 Q1 ]- L1 j0 O5 f; M
ns_marquee.left-=copyspeed
! [+ q3 j, j& z: B0 nelse; Z5 C) T1 z4 V d/ K1 Q
ns_marquee.left=marqueewidth+8) `; E2 P8 g* }6 d4 p% ?7 G
}7 V* E; Q! M8 I
}
. h" J; \ ^1 P S& x h1 m2 o3 \3 |
if (iedom||document.layers){
9 V6 M, e" e$ l9 G% O4 Z0 {with (document){
2 L6 c8 F W, z7 Ndocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')/ E( N3 j5 Q* U9 g( T5 v: R7 f
if (iedom){
2 e4 J* u' b6 x/ }9 h/ f0 u N$ Zwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
1 g* ~- H2 f; ewrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')5 Z& V( S# U# Z! Z' u4 i; x
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')8 r* _# O0 p; B
write('</div>') f. [, `7 P; E0 n, N" F
}6 }8 Y% a2 U) ^! k$ N% c9 z! |
else if (document.layers){, m; k2 x' r1 p: h6 e/ I2 o
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
2 N" d- V! y; Q1 [2 [5 q2 fwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
+ C" k& h% Q1 t& l: @( qwrite('</ilayer>')
y! x1 u! \0 F2 Q7 p% w! O5 }}
3 w: u! `5 m$ ?8 o8 kdocument.write('</td></table>')8 z" O- W+ _* H
}
1 `" C1 c- }6 A; H& \9 ?}9 C# i+ Y9 v" i
</script> |
|