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

|
网页之跑马灯文字特效
//修改宽度
* \8 @: P1 P. k2 V' R" Dvar marqueewidth=300
' U2 ~, `/ t( p$ V# c* J" n//高度
+ g- }& n! R4 c8 ?* p2 z- y* e6 Jvar marqueeheight=25/ x8 |- x+ M) X) F
//速度(1-10)- V% k# b! i' V& L, C' O- e! w
var marqueespeed=3
+ t( y( J( s) p+ ^5 ^4 n- z//背景颜色
/ X9 \' d$ c8 t! N% ?var marqueebgcolor="#FFFFFF"
- |9 ] D. h- E* i//是否能暂停 (0=no. 1=yes)?
4 }$ e0 J. ` B4 ivar pauseit=1$ a$ X6 d" w, [& u7 m/ H: U
! z9 E* k+ ~6 X3 p# y5 b//修改显示内容+ R6 V3 k; B' a! B: t
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'. t+ o$ W9 p' ~
# x+ j/ ]2 d- K- T1 `) p% \
* f8 W& N: h/ y1 I) v6 p
////下面不需改变//////////// B) ?0 M0 \7 B' f" _' ^
& G4 F* L5 A% b. F6 f
var copyspeed=marqueespeed
( O {$ F7 s4 E2 S# e3 zvar pausespeed=(pauseit==0)? copyspeed: 0
" J7 \, _0 O& y0 C) i' m& cvar iedom=document.all||document.getElementById
# c5 `! C# B" F9 Uif (iedom)) p. i" c& F B" d5 l
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'); c9 ~$ ^$ G% j6 i& c$ p @
var actualwidth=''
6 N% o; x' V' |: N/ z) c! X( evar cross_marquee, ns_marquee0 x8 P7 p5 e& n
4 f+ ^4 R* F* { N
function populate(){7 W9 ~* e$ @" ^$ M: j3 u2 r
if (iedom){/ ~& ]" @# r8 J8 N K7 c: X4 ]! j
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
& r8 N1 n t- N$ U. C* m& G* Kcross_marquee.style.left=marqueewidth+8$ S5 }! j6 ^. i v9 x7 |- k
cross_marquee.innerHTML=marqueecontent
. R9 V- c/ w& dactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth# i9 V; f* V$ ?3 h
}; ~5 T3 H$ ?; S
else if (document.layers){
7 w" @' T) _9 ^3 s% [9 qns_marquee=document.ns_marquee.document.ns_marquee2/ }1 a+ N+ {# r) U
ns_marquee.left=marqueewidth+8
* W8 Y3 ^/ P! D: k( l r, T$ }# Qns_marquee.document.write(marqueecontent)5 m h- H# q0 d6 k
ns_marquee.document.close()2 [/ k& U# {4 ^& `9 V! i4 g3 K
actualwidth=ns_marquee.document.width" [% J; S7 P% ^% g. X! C6 z$ ~
}
- Q: Y7 [4 c4 Olefttime=setInterval("scrollmarquee()",20)% M: \! X$ H5 C2 I6 w
} ~8 p( F- |4 z5 [+ B
window.onload=populate
8 ~1 g1 f+ t& T3 v
: p" R5 u" W; p9 d Hfunction scrollmarquee(){
; ~3 n: S1 l8 K* J' R; X9 Fif (iedom){4 Q' I9 O* w: N
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
5 I- N9 t4 }. m3 v. j, S- Zcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
' q+ \' x; B$ W/ M# Felse/ {1 M1 f# \# }7 m8 z) ?% k
cross_marquee.style.left=marqueewidth+8
0 ]2 ? L0 x' b, u- t; d& R& C3 v" _: b3 L! p5 z
}( c8 k6 h& h+ K9 G. ]
else if (document.layers){
( |+ n. P( r7 s% a2 g! X) _0 Gif (ns_marquee.left>(actualwidth*(-1)+8))# @7 d; R5 v, h/ |3 W
ns_marquee.left-=copyspeed
0 L0 c. ?5 V1 l$ E9 pelse
' G/ i* {% V% `. Z. Mns_marquee.left=marqueewidth+8
& _1 z. A( N" A2 ?- ?}
5 r* ]0 H' o) I+ S+ X# D}% f ^$ A) C7 ^$ f
/ [/ I I8 M U+ j% |; c8 I& y' {if (iedom||document.layers){% |: l5 ~, R: k% a) M( j4 [% _7 _: |
with (document){
, e4 y; P6 J- z7 u3 mdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
# C( i7 `3 }' A- lif (iedom){
/ n3 j% m. J# {# V( Q2 M: C X' zwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')3 D6 I3 @; b" C( W
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
: P* e. l" r, |% V, x- `% Kwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
& p, m. j0 v |- j4 I% i Bwrite('</div>')
9 G4 D! l* d2 [; _/ p4 n- H}& [$ y1 K) [* B6 s5 u+ E1 N
else if (document.layers){( Y2 x, R6 b, @% s7 [
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')9 t' ?/ n& ^" Y: \7 b, G
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'), K2 E. D$ ?2 l6 W& Z# a
write('</ilayer>')( t( z" X# R/ w0 h, S9 O$ ]9 k0 r
}4 [) E% n* W; j5 z" N7 K/ q/ y
document.write('</td></table>')$ K* Z% D+ n% y! u( f
}! j2 r8 u; E' u* `
}
/ Z1 W' r# F. J5 Z</script> |
|