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

|
网页之跑马灯文字特效
//修改宽度
4 q- [ y0 ]" Y! S# Ivar marqueewidth=300. K' M" s2 ~( s4 i- E
//高度
6 j, d/ A1 L5 n; ^( b% S5 fvar marqueeheight=25
( U$ g1 m4 F, D. s h! u( B7 {+ @//速度(1-10)
6 k( P; }/ v- v: T. @! B" M* dvar marqueespeed=3* R( j' d8 R( \
//背景颜色
4 U# v/ f* }3 J/ |; Svar marqueebgcolor="#FFFFFF"
, h' j2 Z+ v. t; i4 g6 e1 m//是否能暂停 (0=no. 1=yes)?
/ N" }, |6 k2 gvar pauseit=1: [. H4 _- I/ u
" P8 z3 Z2 c9 ~& R. A' y
//修改显示内容
& c4 ^. T/ ~1 Rvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
7 x8 T$ V7 K, Z3 v4 e
S8 _6 l+ J2 e1 @# G2 U. A. y7 R2 E$ Z
////下面不需改变////////////
. C% C- g9 j! f3 B6 d' P& v/ }! G* W) j3 [+ |+ t
var copyspeed=marqueespeed
; x7 t4 s1 H* @. H6 X0 evar pausespeed=(pauseit==0)? copyspeed: 09 n H; k% f) @+ F% b k
var iedom=document.all||document.getElementById+ j( E& r5 ?; S) l' ~' x
if (iedom): e8 e* W' o. C t: R- k$ T" Y$ g
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
( C- v: f( b3 \9 @ _var actualwidth=''( F S' p! |* p" X' m) B
var cross_marquee, ns_marquee" g7 X f" H$ b, f" c t# x
- D: @2 j+ S F, c D$ tfunction populate(){4 Z# [9 o1 d: K' z1 D$ o. z
if (iedom){, F; p: i. E( M* s+ o; Q9 J
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee0 Z, {% ?; r) B3 e! _2 g
cross_marquee.style.left=marqueewidth+8
1 P2 C0 k7 S9 v2 Zcross_marquee.innerHTML=marqueecontent
# Y, g+ F9 j/ m7 \) v/ p! o2 lactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
# n3 }& Y j) r}7 K0 I4 W. S# C- Z/ N
else if (document.layers){
! y+ E$ D' m1 g Sns_marquee=document.ns_marquee.document.ns_marquee2
) @* b8 S: w$ h9 {ns_marquee.left=marqueewidth+8
- [" W( E2 [' }- ]& l' ?- T" hns_marquee.document.write(marqueecontent)
: z& [& I( h6 i& y: O; jns_marquee.document.close()$ f* {/ o8 L. U0 F
actualwidth=ns_marquee.document.width. K' ?5 p; T' m' [! l7 J F* c
} d4 W* N' B" h9 l* E* o& m- H
lefttime=setInterval("scrollmarquee()",20)
( Y7 z9 |1 x% `* [3 y" A9 G}
# V8 W# F$ H$ }: [9 [) Awindow.onload=populate- g3 u; `$ A9 R }/ H7 |) C
: g$ P9 s3 Z D) B. q, }function scrollmarquee(){
! x* _4 [! C& d u3 yif (iedom){+ \/ N2 G# i) [( d6 ~' ?
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))$ H9 R' ]1 S2 k0 f
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed# T Q3 v- B' P$ P/ ]0 |9 E c" I+ O
else
- o; n& B( h0 j! Icross_marquee.style.left=marqueewidth+82 }( P L* }. [' X H
( _. A& L/ F7 g. B, v7 M}
" ?# m8 n* V* oelse if (document.layers){4 r( ?9 B F/ v
if (ns_marquee.left>(actualwidth*(-1)+8))
& z$ |; X* p( J* Q( Yns_marquee.left-=copyspeed6 U- x# C: N+ A3 C- r) T
else- l" O3 l4 O' q5 s9 h8 j! f
ns_marquee.left=marqueewidth+8, Q7 r) u- z6 {* B1 L
}5 s" ?3 }4 L: g* J; x- E2 C, O- d
}, l3 t2 M" T( W" d* A w ]% F" I
: J7 E$ S' x+ R; ^
if (iedom||document.layers){/ O3 f- o7 m# q) d
with (document){
7 z3 |/ I4 y, L2 ?7 W9 ^document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')2 k8 @* v# }/ k6 ^7 R6 }5 h. Q
if (iedom){% ` S8 U2 j: ^. X
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')9 n$ S0 ~# \3 G% l. H
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')3 o: p2 H) i. ?" e( p
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
: Z' G9 O, v# y3 Y2 Q( h+ F9 Ywrite('</div>')
( T- E; U8 [* y}, @# u2 a! T% R- |
else if (document.layers){
+ h+ m& Q% k" @# K. V: kwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'), l/ ?# _2 U9 T. ^7 z/ P9 r6 d. t$ x( X
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')5 U$ [$ t. G1 s& `: c( w, k, Z% w
write('</ilayer>')
. ~! D) [6 p v. L8 A5 {3 I}
( f5 k% ^' M0 Y3 c% i" ]document.write('</td></table>') \$ z- {/ l# X7 @6 N& A; X+ g
}
- q/ h- B$ _) z7 \% [}3 j1 x# |7 a0 y
</script> |
|