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

|
网页之跑马灯文字特效
//修改宽度
8 \/ m5 X; O5 N' L/ n6 x" uvar marqueewidth=300! |/ T9 b9 n* v5 p7 o
//高度8 {, s* h; }: S8 _2 i
var marqueeheight=25
1 L W2 t5 ^# d4 t//速度(1-10)
; E7 h" y9 t3 A+ T0 K+ |% j; S' ovar marqueespeed=3
, X( l0 ~$ @1 E2 O H6 u! B//背景颜色! I* k# E- c( d7 v- C
var marqueebgcolor="#FFFFFF"
7 @. _0 M4 k: }- }7 T//是否能暂停 (0=no. 1=yes)?
6 P+ g! d$ {8 `3 cvar pauseit=1, K5 q4 A9 y1 U/ q% w5 ?& D% ~2 s
+ p e: O N. F//修改显示内容
0 [3 y0 Q& e2 `$ U* j0 _5 Xvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'0 X0 |+ k; Q8 I- N& b3 M' v) n% s' |
& U7 J: L, x/ H; t
6 s# u# M% q1 w8 W////下面不需改变////////////
; g! f; i) ?/ E4 E- ^ Y# }& ^
7 Q/ w' A! S" C9 Z4 }7 K" J( V; M3 Avar copyspeed=marqueespeed2 [( J: k9 [ J
var pausespeed=(pauseit==0)? copyspeed: 09 h. E v& C& {3 }9 S
var iedom=document.all||document.getElementById
& ]2 E' I3 p& o4 I* c& \if (iedom)% o$ ^+ U% {; I- o r
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
- Q Z! F. F8 J& q8 z. ?# Dvar actualwidth=''( D) E7 V; E# a1 @: B
var cross_marquee, ns_marquee- h; k' `: e( ] V5 z
1 f/ G% F4 E6 d5 U7 K" Ofunction populate(){0 c0 z) n% M9 p& B
if (iedom){5 o' E6 Q! j+ b6 w# j4 B
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
4 q5 G3 w2 X+ K" ]8 Fcross_marquee.style.left=marqueewidth+8
$ R5 o* {& v4 K! X& lcross_marquee.innerHTML=marqueecontent
5 H, ?' s5 j5 `5 n9 B5 ~actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth7 \( a- ]) I6 b9 P) n+ d
}! m% H, I1 z9 U# Y
else if (document.layers){
3 f K" } \7 t5 p: s- Rns_marquee=document.ns_marquee.document.ns_marquee2# s& F3 x: @2 W: w- ~
ns_marquee.left=marqueewidth+8- {2 \% M W6 E3 Q8 r* e3 j1 n
ns_marquee.document.write(marqueecontent)
' O$ @- l8 U# r/ [7 e4 Dns_marquee.document.close()5 b" U: R- k1 p! G6 N7 ?
actualwidth=ns_marquee.document.width0 _8 Z- ~; q1 B8 f$ O. m6 c m' W
}. _* W2 z0 y8 R, I) M( m* {
lefttime=setInterval("scrollmarquee()",20)
; B9 t0 ^9 m. c! B$ A e- R5 A}* k2 d6 p9 b+ _0 F! s- s5 S
window.onload=populate; J8 ^0 r0 W/ F; j
* n) f$ l! B; o. B3 j4 }% Sfunction scrollmarquee(){
, D# n* Q! c5 H! ^2 Zif (iedom){- p' j1 s) d* V/ q
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
+ X! M6 h7 J5 g0 T L% ~: ]& ?5 icross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed8 o) Z0 g; J2 X% f, l, M
else
8 [9 E8 D. u4 P& Y9 pcross_marquee.style.left=marqueewidth+8
1 B' ]$ k) _6 z" V; x6 Y
8 c% q2 o+ J$ D+ Y/ X o}' u [. S+ U8 O
else if (document.layers){" }$ k2 ~( p) L. g
if (ns_marquee.left>(actualwidth*(-1)+8))" S! Z, A" S0 T" n7 I
ns_marquee.left-=copyspeed0 J% C; Z, \+ }2 _6 U; e
else$ D* P7 U- ~! H. @4 p3 }+ I
ns_marquee.left=marqueewidth+83 Z. j8 Z3 w3 {& y/ i$ `
}
! H8 ~ ~* C- u}; k, ~- c. r" b0 O
/ }. ], ^# X. D4 X# B$ P. o
if (iedom||document.layers){
o7 b+ C' D; |6 |* p, S$ @; R$ N0 }with (document){
" j% M5 c* O0 l( x, _document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')* u8 L$ C+ N1 s( `! @
if (iedom){
; G& x+ A. I# x* [, o. Fwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
, t. m. @6 t- ~2 w$ }/ G9 s: Z( o5 jwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')$ _- C8 [3 [+ E9 ^, o1 ?- P
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
3 v7 T; q! w& Q. Q1 m, k) ?2 S1 wwrite('</div>')
. r2 B8 U' H! c! j}
" [% K7 a8 Y0 T: Nelse if (document.layers){
+ p: C- x+ w: Vwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')# Z5 b3 O# `* k4 a' f( c! r
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')# ?* Q5 i. N2 l" h0 v/ i
write('</ilayer>')
+ A S2 z+ q, u& H* {. f# q}
! U" j0 D Q$ z) Z& Odocument.write('</td></table>')0 W, P, ?4 J' }: M( \, h
}7 t: N* W. x( b' k: ^* l) f
}/ |0 g$ G7 g8 N/ l( z+ j; ^
</script> |
|