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

|
网页之跑马灯文字特效
//修改宽度
8 D3 L/ t# s: |0 a. Lvar marqueewidth=300
- g, \" P) o& q5 d. f" H//高度
R4 J& R, o! O1 G: Z, g" B( |# L1 }var marqueeheight=25% t' S! w, ?8 D" I3 D' P5 d
//速度(1-10)$ X i% @$ p6 ~
var marqueespeed=30 Z; }3 z" r& T- A d" Q' ]
//背景颜色
3 y: J+ l9 J7 f- s7 l% @var marqueebgcolor="#FFFFFF"
. q1 b3 V3 c0 g( E# V0 s Y//是否能暂停 (0=no. 1=yes)?
. Q2 d+ w8 W3 O. e0 hvar pauseit=1
0 l$ V8 o8 X" K# L% `; |2 ]( I" q9 z$ u: x! D+ Q6 L
//修改显示内容- q8 O- ?5 G& c) W$ V) M N4 h' Q4 ~
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
9 }: x: K5 a$ b4 _3 S3 l0 a* z
2 r7 a& J* _5 P
- C% ^. O5 m* X/ c/ [4 @2 b////下面不需改变////////////
7 c: r! x" l5 C! K0 L2 O
3 D( W* P3 I; d h* Qvar copyspeed=marqueespeed* j+ Q1 s6 h% l# J
var pausespeed=(pauseit==0)? copyspeed: 0
7 Y3 p# y( e) h" hvar iedom=document.all||document.getElementById# F( U, H1 d( ~0 P! L1 |
if (iedom)
( C9 V( g; `4 G# J& b7 R$ \( ^$ g" edocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'): T5 e& e. M5 k* b u( d
var actualwidth=''
" [* |, J5 P1 D+ c! U( y+ ^0 {1 Yvar cross_marquee, ns_marquee
9 d" n0 |2 [# r6 u/ D; Y( U, p
8 m: |3 D; W+ \' jfunction populate(){1 N$ r% x, X+ W* V7 @
if (iedom){! [' e+ g5 }0 n/ b/ Q. z; i# Y. U
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee! V( ~& ^ y. @) r' N9 N' d
cross_marquee.style.left=marqueewidth+8
( y8 e6 \0 l# ^cross_marquee.innerHTML=marqueecontent' V5 \# [' c3 c! q o4 s8 M
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
/ h; V J8 n- k# h E$ E- A% G}
, x3 w& \ f: S5 D+ relse if (document.layers){
' m6 Z1 O0 Y9 J' K3 kns_marquee=document.ns_marquee.document.ns_marquee2. B& ]) C& j. r
ns_marquee.left=marqueewidth+86 W! h! R5 I3 T8 x$ e
ns_marquee.document.write(marqueecontent)
- x& w$ [+ G; }. ]3 N% ]ns_marquee.document.close() X, I' D+ R9 H( K( D0 D+ _
actualwidth=ns_marquee.document.width
3 e( u, g/ h% [4 J}; u' k5 A, Y7 s/ y& g- }
lefttime=setInterval("scrollmarquee()",20)1 s' u4 N# @" c4 y, g! ?
}+ h6 q% C7 C# x
window.onload=populate
4 s4 f3 ]; l- U$ _2 m$ o! |
; u4 {3 x A3 b Z9 a. w. Cfunction scrollmarquee(){
# i/ |7 ?* m9 h, S. V* m ?4 u: L2 ?if (iedom){# r* E. F, k9 r6 m$ p5 R
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
. `) E5 J3 I8 f- n& O4 `cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed' A8 ~* K4 A- j _
else
; g3 U0 m: r& l( K5 i: zcross_marquee.style.left=marqueewidth+8
1 g1 r/ s/ T- C, {; A! {1 z' j: {( @7 i% `+ Y7 x
}
' c* u, @; I4 |else if (document.layers){
4 N; e: I5 j1 L% L" i/ I) K2 qif (ns_marquee.left>(actualwidth*(-1)+8))/ p2 X) g6 A; u/ t
ns_marquee.left-=copyspeed0 b' S7 a5 X8 X
else
T( W1 u* p0 H8 v, r8 V' qns_marquee.left=marqueewidth+8
( v9 L6 V( k) X- q. N( M5 F/ @}
* Y+ E$ p& l1 N* s2 ?( N8 m2 g6 A}
7 G( T6 j$ k1 ^. h
+ {, q/ Y5 z+ y; N q& _, Sif (iedom||document.layers){
: S0 N% q" c, s0 Rwith (document){
2 a) c* a+ }. _; D# u% c1 fdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
6 u' Q# |# o( h9 s, C2 Bif (iedom){% }1 M& n( g3 ^- D3 m& B
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
2 V% P( i0 t s6 ?0 A) ywrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
5 `0 q) z: M6 h9 [8 u$ l; G" R6 Lwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')* O1 M* t5 s5 M) h) y
write('</div>')
' [6 L4 ]9 R& Z}
; a0 i6 Y( b: i" X: N! Y2 _else if (document.layers){6 p- x6 x6 B9 `4 M Z8 A
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')! D2 T: a3 `: i: V0 E
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
" ]# P5 \" \' O) |4 z- d+ O7 Bwrite('</ilayer>')/ P. i* n$ W: U8 ~& x$ S
}
2 _/ K" I: n: p8 Y) n# y+ ^7 xdocument.write('</td></table>')
$ g) y& [& J' u* p& }# {}4 r; |9 j5 a& k
}
9 m/ Q% d, L1 d) H</script> |
|