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

|
网页之跑马灯文字特效
//修改宽度2 t' w$ K( ^& ?& V2 \; Z. `
var marqueewidth=300
$ i* y$ P9 v0 s//高度4 G# l) X" B! N( F6 M |' ^" H G
var marqueeheight=258 }2 J, n% _, @/ `/ \# O; T; }
//速度(1-10)0 j. H. s/ d8 N; L1 H
var marqueespeed=3
: J3 {0 r* I6 `; T//背景颜色0 h! P+ g) F8 w+ w: p
var marqueebgcolor="#FFFFFF"
' E. G2 q6 t! W, H% j//是否能暂停 (0=no. 1=yes)?- B0 ^$ p2 D* p* `( s' z+ B
var pauseit=1- y( d" B3 R+ a3 N* p
& M. c: {( I. \) i* G- W) d
//修改显示内容
2 W7 C; N- _/ |) Evar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
! c0 ?( }9 Q6 A: c
1 A1 [$ T% }% { N
! g8 b5 ]5 M0 ^: r( G t) k k////下面不需改变////////////
6 T, E/ m a- B- {' F L* K! J6 L5 ]! l& C0 n5 v
var copyspeed=marqueespeed
: H& i- k' W$ N9 Hvar pausespeed=(pauseit==0)? copyspeed: 0
& }' ~' W' q; p- B) s# ?. e4 i! gvar iedom=document.all||document.getElementById8 D0 z8 Q4 k9 y! w; V$ Q6 ]9 D) X
if (iedom)
: w4 i+ B. s8 R1 a. Jdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
7 a0 B& B8 {& C% ?var actualwidth=''
: K2 F; Z8 x1 ~# jvar cross_marquee, ns_marquee) y+ P, {$ \: z `5 z+ v0 p
1 M$ `9 S7 a4 c' R7 k% }' Gfunction populate(){
7 G! n2 J- v ]if (iedom){
2 S% B; i& ]. v2 Ecross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee/ }% q2 Q+ t5 H5 `( a* V1 Y: \
cross_marquee.style.left=marqueewidth+8
% N/ n, W$ x% I9 n$ { F* mcross_marquee.innerHTML=marqueecontent3 O0 e1 `+ h' g5 k3 t h L: P
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth) `* k- I5 B' n
}$ [4 \" p( P* k; q! E8 b. P8 I
else if (document.layers){
$ ]9 \8 S+ W* s+ l% B9 Sns_marquee=document.ns_marquee.document.ns_marquee2& R' B% n6 U5 v C6 Q- ?
ns_marquee.left=marqueewidth+8/ e& g4 n6 k, Y$ x% B. ?" j
ns_marquee.document.write(marqueecontent)
5 R' r9 |1 D' q, _4 f! [+ {- ^/ lns_marquee.document.close()/ x7 b, A/ u+ ?1 \( b2 K
actualwidth=ns_marquee.document.width, s/ o; y/ z( Y+ L/ F7 D
}
' R6 [8 j; T. [( `- ulefttime=setInterval("scrollmarquee()",20)" M& d- C( _8 Z' S8 ~4 ]0 Y) }/ b
}
0 v0 v7 h* a# X0 _% x9 {9 ]9 Nwindow.onload=populate4 W6 G k5 ?8 s' H, y% [. v
: Y0 K9 V" i( z/ cfunction scrollmarquee(){, O0 F! R+ k& _+ v3 S
if (iedom){
0 I1 S4 c; D. M: n' |, g7 Qif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))9 W+ J6 [9 s# k
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
: u# J1 M7 A# C; G- helse
. A* e- d Y! u: Y0 r0 y% O& g Wcross_marquee.style.left=marqueewidth+8
( N: I, r( g. O3 J& x' L
# v8 f6 \* }( `" i}
! h% g" L+ N9 G- Nelse if (document.layers){% m% b+ i9 I) j( _1 G- N8 g
if (ns_marquee.left>(actualwidth*(-1)+8))
! [4 |/ x% L; C$ B' w4 mns_marquee.left-=copyspeed6 d' U! |& X+ C1 f
else
- P6 l% r: q# ^/ H0 Sns_marquee.left=marqueewidth+8# R; n( f1 M! h1 Q
}
. B5 |8 E* B! ]/ }}0 O2 i; _: l! i6 T# r( y
- S" o6 I0 x! S) g J8 b% l- fif (iedom||document.layers){
4 f, q; N; E# |/ N3 Jwith (document){
% C$ }) R5 W0 \document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'): t- S! z1 X/ W: e8 p* ^6 l
if (iedom){4 e( G; h& u# l) ?- q9 A1 l' d
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
" d+ p1 B. W' Ewrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
4 T# I( A6 V0 ^8 N$ G1 Owrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')% U5 e" W3 B( Q4 ], o9 v0 M
write('</div>')% i5 f0 C) _( [2 S
}1 U T6 F7 ~: B
else if (document.layers){
6 b. N$ c* Q6 Y: I( b1 ]write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')" ~5 a8 e* b9 t) X- J0 {
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
0 k" h7 Z B T' Gwrite('</ilayer>')2 X$ u: {) S. r4 ?6 P9 c6 S9 D) T- r
}
$ a" ]" B* o. C$ ]4 [' k; P5 l1 Jdocument.write('</td></table>')
* l' n: q" x0 d& \) @}
0 A4 C1 B7 Q( @/ b+ w}
; Z7 `) u, |, f% d</script> |
|