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

|
网页之跑马灯文字特效
//修改宽度
J3 @1 V5 i' F/ W1 B6 c) avar marqueewidth=300( u7 S+ H( C. @
//高度 _, r2 M3 r: T* m2 S$ ?5 N
var marqueeheight=259 a! z; q2 A2 P: O. }+ N9 |0 o9 O
//速度(1-10)6 `! {+ S# C3 s& c9 p9 N! g5 W
var marqueespeed=3' @/ C. a. K" n3 _ F
//背景颜色* I4 K3 l3 D* W X
var marqueebgcolor="#FFFFFF"
, J8 v5 y# _: c6 P; E% \, a- H5 g4 G//是否能暂停 (0=no. 1=yes)?
, y0 y1 ]4 y# w3 S o. }6 |var pauseit=1$ {3 S3 p0 L* }+ r v
$ d* V* Z/ h! R8 Z* _/ r$ H/ P/ b//修改显示内容
( [' B- @; q/ Y7 l5 p7 Ivar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
) f' c4 l; {. n- \8 N* J. T6 |7 e# R9 I! r
% J5 L0 d/ F$ }( U2 }6 D
////下面不需改变////////////
$ j; h, Z$ U: B8 E6 k# S& e; s/ V. s7 i6 P: y1 F1 G
var copyspeed=marqueespeed9 }. y* x7 ~+ n3 O! E# \3 F- a0 R
var pausespeed=(pauseit==0)? copyspeed: 0& N- C7 E6 p8 N
var iedom=document.all||document.getElementById
5 w: w$ H, ?: _if (iedom)
" C$ t4 g5 \9 [& idocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
8 |! e1 A* k9 Z2 W7 `* z3 Yvar actualwidth=''
( z! H' u& K6 d$ m/ K& W" wvar cross_marquee, ns_marquee* {' b1 |) f+ ]7 s
2 J" X! C) ~7 T1 i/ Ffunction populate(){. A+ D2 N1 Z9 b& [
if (iedom){
" {& t3 \" m T* e9 |. d; U7 v: icross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee3 x! |4 I1 E6 U
cross_marquee.style.left=marqueewidth+8" P9 k: y3 j5 ?( u$ U( \6 _4 L' [
cross_marquee.innerHTML=marqueecontent' }% _$ ~0 Y- W1 D& @
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
1 ^' o& M! m6 F/ k* o}
2 D2 _' ]' l0 |/ R+ Delse if (document.layers){
) h3 Z7 b6 G( `" ~1 f% Tns_marquee=document.ns_marquee.document.ns_marquee2
: b1 |, g, K. e) D9 d6 a0 Jns_marquee.left=marqueewidth+8
9 B! V1 t l- I" zns_marquee.document.write(marqueecontent)/ ^/ m0 W; O# S0 w0 J5 @3 |
ns_marquee.document.close()
7 Y) P8 I9 V0 E8 T4 {$ f" V: k9 ~/ Jactualwidth=ns_marquee.document.width
8 b% t4 E+ S' {2 |+ W5 G* Q}
% ]( H: |, a6 D: z# _& [, ?7 plefttime=setInterval("scrollmarquee()",20)
3 N7 d4 d2 G- }& R( G' |}
6 e4 h) ^3 I) b' Rwindow.onload=populate) P( S8 i9 Z8 m
7 D. A. j' U" G* Q5 i2 Nfunction scrollmarquee(){$ }/ s/ A% m4 D8 ?, V6 {3 v
if (iedom){, C5 L' @, K% |8 q( {/ Y
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)): T: K6 D6 r9 I7 n" l
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
4 C; X4 X$ e' C* D+ gelse3 y# R( B. n9 j6 H& K
cross_marquee.style.left=marqueewidth+8
9 z6 ^- c; ~) a# N+ w
1 E# y9 G1 D; ~+ z% y}% ?4 S, e* b$ O3 G/ V `
else if (document.layers){! \, C% j$ ]" M+ P( m1 B( T
if (ns_marquee.left>(actualwidth*(-1)+8))
# g, Q, M5 t' c0 Y2 p* Q8 Sns_marquee.left-=copyspeed' O$ x# j( l# S5 G5 @8 l' K1 B
else2 O+ Q6 I+ q/ [4 N8 m1 x
ns_marquee.left=marqueewidth+87 D- ~" _$ U p1 [/ P v# X
}
9 d' \* Z, f5 a3 @& C; Q6 X; Z}
( X2 Z+ f9 R; H5 ^4 Q: N
; F6 H1 ~; S) W# h4 }if (iedom||document.layers){
" u) ?1 O0 k/ s& [* {( @3 j) v, Cwith (document){3 Z" G# q& t( ?; _
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')/ p3 w: f: n0 L
if (iedom){/ F T- j3 y6 ?# ^' W5 n$ r
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')9 a( V: s, C7 K; P
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')) z2 R! g% C/ t" D/ H0 Q: O
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
4 _+ N7 x( ?/ xwrite('</div>')
- T+ ]& a9 |, U5 P}7 u' f9 |; V& d
else if (document.layers){; k7 ~3 K8 Z3 O) W- I
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')2 R# N6 n& a- w6 }. s
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')" B! F! k4 S) H8 `
write('</ilayer>')- X# W3 U/ H8 }- n# q7 y
}& [; X z& W5 |+ x6 S
document.write('</td></table>')3 v5 A# g( b( V& o U r" D' C5 O
}8 i& R' ]- Q3 ?$ L
}
! g5 i' o) K% @1 g& X$ O</script> |
|