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

|
网页之跑马灯文字特效
//修改宽度( O ?" ?6 e% h! @' l' b
var marqueewidth=300( I* O9 }+ \% g
//高度) L- s+ {5 x# y0 m% Q; n1 Z5 q; h
var marqueeheight=25: n9 R \+ s# h7 @6 T$ x
//速度(1-10)/ X3 z; K7 J0 j: l6 K
var marqueespeed=3
+ G, G% C! H& Z/ r% e//背景颜色
" s! g0 h7 N+ e7 Z( K2 o5 u5 W$ vvar marqueebgcolor="#FFFFFF"$ ?0 X% j% _# p0 E1 E1 E6 _
//是否能暂停 (0=no. 1=yes)?8 O9 R1 O Z9 Q6 U. n0 O& d
var pauseit=1
8 x+ E: Y8 i# D$ }2 M# h4 _# ]& m6 X7 u: H
//修改显示内容( a& Y* T) T$ C1 i
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>' h' X: {9 a( ^
, j9 D# h/ x! I6 u3 ~$ V8 Y( M! y6 y, L6 h$ j& p: f7 v0 s
////下面不需改变////////////
% \& i8 v+ G- Y9 A+ L' [3 I% ?4 [7 i& J. \9 @
var copyspeed=marqueespeed
4 w4 D, B' P' W! G! x( avar pausespeed=(pauseit==0)? copyspeed: 00 Y! k6 d& L; h" z/ |7 ^: s/ o" b
var iedom=document.all||document.getElementById# X5 B1 @" q5 R- L+ u
if (iedom)' J( o7 g* ?3 M$ ~
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
4 T q& l Y% W' N0 [var actualwidth=''
- L" @% K' t( u3 w+ vvar cross_marquee, ns_marquee, a" J% j: m8 g+ U# R4 j3 b: a
. ~& T! S% f/ Bfunction populate(){' N' \1 p" r7 J# d) L6 S
if (iedom){
+ `- _" Z; B* r1 m0 N) f L$ c: N( Q) Ycross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee' Y! y# X, u, |8 R
cross_marquee.style.left=marqueewidth+8
# A( w- X8 ]) h" U! W! xcross_marquee.innerHTML=marqueecontent
% B% E0 M4 Z1 b- \0 R7 c0 P9 | o5 wactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth: C- }$ k3 g/ [8 C5 k
}
& ^3 H$ }7 U& M5 f% G1 b9 q+ Z/ ]' @) xelse if (document.layers){
( G/ b, G/ l: @% Gns_marquee=document.ns_marquee.document.ns_marquee24 I. B5 P2 V. g3 D/ n
ns_marquee.left=marqueewidth+8 S, a2 `6 r' q0 Z! |0 }' e }, [
ns_marquee.document.write(marqueecontent)
- T" d0 M }5 k1 T! s9 Xns_marquee.document.close()
# m2 q6 C6 _0 ^$ e8 a6 \$ gactualwidth=ns_marquee.document.width
% s n. M; g1 J9 `+ Z. u: j}) g* p7 ? i) v& Z
lefttime=setInterval("scrollmarquee()",20)
. Q2 p. N; ^* g8 N$ B- l}
4 D" P8 O: d5 s! G, i- i5 w1 Swindow.onload=populate: o" T, P. V' f
e# d6 _6 g- z U6 D* {) `3 \function scrollmarquee(){
2 p, G% L' G' S% S+ a3 uif (iedom){1 U2 o1 ]1 J3 m+ y& T G, k
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)): ~1 R' M; m/ {4 {* h8 ^( K4 o8 a
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
- O- n, B7 M% x& J7 ?; oelse
, o- `7 ? S3 q0 o0 Rcross_marquee.style.left=marqueewidth+8, E5 h3 L/ B. _* G+ r% _3 u
1 g+ S: x9 j* T& t} m1 k5 h- S5 W. j/ U5 @0 J) l/ H
else if (document.layers){
6 s, n1 A9 J" O4 I: H+ ^if (ns_marquee.left>(actualwidth*(-1)+8))& b" N4 q3 O4 C9 \- ^' C8 ?+ n( j
ns_marquee.left-=copyspeed
! I! K' l2 f; jelse
; C" n- g) n( a8 [$ H$ f+ Wns_marquee.left=marqueewidth+81 N& g c- ^% M
}( R! p& b; [6 I$ B( `! v2 F E! G( A
}& M! x7 l, f |, s) ^) h: Y0 D# r
; B2 N8 G+ H2 P8 d
if (iedom||document.layers){
' r A+ Y: Z5 B# A+ X6 @8 A$ O: owith (document){/ n) M% [+ J7 m8 m; f
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')5 P1 z) ?8 ]2 j
if (iedom){6 K2 M7 I+ z& X P
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
5 [4 {6 |" A: m/ K; Gwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')" Z+ Q( f2 M; Q& S" B: }& o" C
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')$ y6 A# s: ^" D: q
write('</div>')1 a2 `) ]/ M( ~+ V3 }! q* p
}& [1 I1 \# w; {% c9 B% X
else if (document.layers){3 C6 ~% v: p8 N& A: j* v
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')" ?5 d. X$ d1 s3 U8 q
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
* A4 v- K- u3 n7 I/ d) P7 F6 r6 twrite('</ilayer>')
" F+ C, [ A2 V' z% Y}
* f. S" g% m& Y# zdocument.write('</td></table>')
( P; I+ R) }8 m- c8 |+ U. t}( C! P! I( S& Q
}/ A4 T' e+ V5 A% b) {
</script> |
|