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

|
网页之跑马灯文字特效
//修改宽度
) l. l+ o& y" N% `8 j4 H4 ?) B1 Wvar marqueewidth=300
( B: T1 f, R- Z, r% S//高度
5 \# W( `: c# S, V% P% Fvar marqueeheight=251 W- v! q( E Q" R/ O9 W! Y
//速度(1-10)
+ j' m) ?1 B! i: s/ evar marqueespeed=3
4 |8 Z. v% V0 o1 ^% j//背景颜色+ G4 |( ~. M G9 V3 h! d
var marqueebgcolor="#FFFFFF"
- w8 B& o; q1 |1 G//是否能暂停 (0=no. 1=yes)?
V3 t& [! W! nvar pauseit=1( N+ l) E. m7 z& s9 i) Y
- x" M# x: o( a0 Q, y7 S//修改显示内容
2 h2 D& U2 [" Z4 w& Nvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
3 U7 ^; x: z0 B# n# ?, z. V: X
& a' w. E! x+ F5 v- z3 J6 o
- g% O+ n& E0 c# s/ o, ^" v8 t////下面不需改变////////////
" B- W6 j G5 n. W, K
: n# Q' X7 t5 j& r8 dvar copyspeed=marqueespeed
; t" _& S7 V- Mvar pausespeed=(pauseit==0)? copyspeed: 02 ]5 S9 e# I% U' j: u
var iedom=document.all||document.getElementById$ Q9 I* W# ~+ y6 j3 n' y# t
if (iedom)
5 O1 s4 j& i4 F4 ~document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')( E4 j+ c {, I( C- I7 v( n( }
var actualwidth=''
, ~2 Y; \9 [" b, Y) Lvar cross_marquee, ns_marquee
8 C" A1 n3 \# a0 s |1 q
5 ]% b# X7 Z3 d6 Y% Tfunction populate(){
) n! K" {- D' N, \9 X! v0 y) ~if (iedom){6 E( o5 D. S7 t$ x; f3 ~
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
+ u4 p7 A' q% {4 ucross_marquee.style.left=marqueewidth+8
0 t* r% J7 b; R5 ?) y/ }! }cross_marquee.innerHTML=marqueecontent
5 d0 B% L/ E; ]% H, p, Dactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth6 I2 m2 ?7 D4 b$ R0 M+ |- J' [
}
1 T; V& q8 T9 f2 aelse if (document.layers){
4 P" g( g. e( X: q F0 A( `" hns_marquee=document.ns_marquee.document.ns_marquee2
9 S# }* K1 v& z/ Bns_marquee.left=marqueewidth+8* ?! A% U' @7 h( X& m
ns_marquee.document.write(marqueecontent)
% o$ ?# w0 f8 x0 n9 T/ w" Yns_marquee.document.close()
; T: T4 {$ d$ ?7 [( Yactualwidth=ns_marquee.document.width
9 o. E5 Z# G+ j+ Q) b, ~/ }9 q}7 O7 l% q! F) z: i7 V: e
lefttime=setInterval("scrollmarquee()",20), {" t- K C- u, x [' y
}
: n3 |) @1 o9 o( }+ N z4 Rwindow.onload=populate
- |4 y) e$ _+ f! H3 r2 \5 j0 \
function scrollmarquee(){
9 ]. E! t( a+ P* Q. f$ g& Gif (iedom){6 [+ V; M3 e4 H9 T" n" S3 _
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))# L5 E- B% U) w1 U# L
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed1 x7 e1 t' N8 b' j: v! ?. w
else
) n/ Z T4 I2 M$ U7 V I4 P+ ]cross_marquee.style.left=marqueewidth+8
+ s% V- l {, f# j" G3 X- G; \) V6 [/ |) @. ]- `- Q/ F0 A4 u% i
}7 W6 A [3 Z1 t. _
else if (document.layers){
3 x9 E$ ?/ C2 N( Z& t9 `1 W& Eif (ns_marquee.left>(actualwidth*(-1)+8))
6 m1 m3 X+ j' F& [% Rns_marquee.left-=copyspeed. G) n1 h8 C' X' L
else# w1 Y5 x. h& B5 ~( U f+ m4 `
ns_marquee.left=marqueewidth+8/ T+ ~$ `5 j* s& I
}. |9 U) E, W2 x" g# X8 w% x* G
}
7 y1 q: s* G& \- p
: v" p9 p7 }; w9 r) `" @; i6 Dif (iedom||document.layers){
6 S2 j* R/ q: y7 p- s( r8 }! twith (document){+ n' F( k. w ~8 f
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 T5 p9 k5 B a- j; C# f! y
if (iedom){
" ~9 X0 z3 ^3 e6 E; h/ Wwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
8 M6 h+ F+ W: U$ Q p( twrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')* D# r- M$ [+ _: q; u2 p& S' E
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')/ Z9 q6 N" _' n
write('</div>')
$ L2 y+ z+ ?9 {0 X! ~6 S}
& S8 B0 O* F0 X! }. X9 t4 Helse if (document.layers){
( U1 I: V/ l" }write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')+ e; i; H) z B. u; X' A/ _3 @% L
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')5 o3 V( I; \3 J
write('</ilayer>')- A& _6 g$ t3 u
}
8 f" B* a- A+ I; \document.write('</td></table>')
$ }2 z, F) g" r5 d. F* J+ n& G} n4 C+ M! _3 b: i: @( e: ]( P
} P( J1 w: N* N3 m1 j& U
</script> |
|