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

|
网页之跑马灯文字特效
//修改宽度* e9 y! k9 s+ B$ l V5 G( d# y
var marqueewidth=300
' N4 X9 A2 w, B' E3 a//高度" F4 I, k8 B/ T# p/ J; }
var marqueeheight=25
. W$ S' F3 F l4 c7 ^( q//速度(1-10). P$ S2 N5 D- @+ _ o3 u* r
var marqueespeed=3) }7 s( ~9 F2 V+ ?. g
//背景颜色' `7 Q, R4 \8 V/ s* O; f
var marqueebgcolor="#FFFFFF"! g2 p( E/ ?; k7 D* Y
//是否能暂停 (0=no. 1=yes)?( k7 S; p. Y" _
var pauseit=1
6 ^4 c; O2 T7 x/ G5 m' @5 g% x; f- d9 i+ i) p. l
//修改显示内容, s) W0 @9 k4 y. V! ^0 r" [1 `
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'- q; ^: t* h- ~5 P( [! ]' k
+ W ]5 P0 U9 E( G9 D- p& m, w
* u( X4 p5 ]3 z3 p( j# a: U; ~3 z////下面不需改变////////////
0 v& r b5 K" p* P6 |
6 e- {" G7 m0 w' {1 y" }9 X+ Pvar copyspeed=marqueespeed
! Q# j# i" |$ f3 a6 ?) tvar pausespeed=(pauseit==0)? copyspeed: 0
4 Z% {+ {: V0 Z z2 T8 o2 ovar iedom=document.all||document.getElementById
G' x4 p) M# q) g+ N1 }3 Hif (iedom)
5 T7 E+ a# H) l( _8 h1 ^document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
: |% `5 C P/ e" @+ V9 Hvar actualwidth=''- t: _* ^/ h8 N: n1 e
var cross_marquee, ns_marquee
2 F+ Y) j5 }! R# h" T8 y* r
# Z; o8 v b% ], d! rfunction populate(){# }/ J- V# m4 C
if (iedom){; j4 a( l0 d1 Q& i$ i
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
) @: W& `: O) C; D9 Pcross_marquee.style.left=marqueewidth+8
: Q4 m; ?, h' d$ Qcross_marquee.innerHTML=marqueecontent
. p/ v* R; } D5 Gactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth& d8 ?" o8 E9 ~; y
}
, X, Q# q* b' Zelse if (document.layers){: x/ G! g: i9 B8 r P% Q
ns_marquee=document.ns_marquee.document.ns_marquee2
5 H: x+ J' M: W% Z( n. R3 _8 ?" l& b1 ]ns_marquee.left=marqueewidth+80 ]- @7 c3 t0 W$ e# ?
ns_marquee.document.write(marqueecontent)
; m3 x; ~7 }5 ^0 T& N$ {; [ns_marquee.document.close()0 h9 Q1 J" a0 P2 Q/ }
actualwidth=ns_marquee.document.width, k( c. i/ b2 Y% b) M0 h/ D& M* x% S
}
2 j1 ]& l/ T1 n: k( u% Plefttime=setInterval("scrollmarquee()",20)- i2 i( x% O( `; F& N9 s) U
}. N. q) C# ?0 j, l) c
window.onload=populate
/ m6 {& T. A, O3 Q# |- c% S# @3 [1 E e0 Y& u' {) r( y! Q( e' @% D/ W# z
function scrollmarquee(){
$ t7 V5 }( l1 b# A# E' c* Jif (iedom){
" [* G5 o, X3 _6 r' u9 R1 G) a% f; eif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
6 H2 X% t5 D4 ^) z: z$ w# }cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
6 @+ W2 E) j) p' o1 welse# U2 U* o0 o- @
cross_marquee.style.left=marqueewidth+8
- q0 T8 Q% Y3 {
4 l9 }( g) G! B; T+ m$ d, [4 L) P7 `}8 P, O6 @7 L/ z: y) m
else if (document.layers){8 G4 I7 l2 S P6 ?
if (ns_marquee.left>(actualwidth*(-1)+8))" {1 {/ M1 o& H0 X: E
ns_marquee.left-=copyspeed3 V9 }2 }# `/ h) @- t: [; D# y* j0 i
else
) p- W, y2 c/ q" E- Y& c/ _) h& fns_marquee.left=marqueewidth+82 {2 L9 Z X; }. M
}
t; {0 N2 m- W7 d+ I# Z |6 H% V A}8 `; d& [# }" N+ ?9 L S
% T" z, P2 p- T" ~& z" K
if (iedom||document.layers){
z# S1 K& x) ]/ v7 Uwith (document){5 g7 [9 ]" D% A7 T; D
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')/ W+ c4 }. W) H0 U' Z% ?5 c" j
if (iedom){
/ y: ?) ^. Q0 S5 Cwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')' `0 U$ `) |* p
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">') K G2 J! _: ]8 U
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')" n% j& U, |+ D+ I* r
write('</div>')
5 ~1 A' G: t0 I/ Q% }9 H}
7 r+ U2 |7 z% ]) q2 gelse if (document.layers){" T& v9 A$ ]; N/ R' [
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')* T6 |5 j+ C1 ^# A0 W2 S' g
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
8 ~2 }- r" s+ [3 j9 l( M+ iwrite('</ilayer>')$ f$ V' i6 B8 S
}
9 E/ n r8 w3 pdocument.write('</td></table>')
$ |# W! S' m* ~, [% P; E}( y- i( C% d/ O. w
}
" a1 x [1 P* f; n! Q0 e8 R</script> |
|