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

|
网页之跑马灯文字特效
//修改宽度
8 g2 @* [2 T' hvar marqueewidth=300
) `5 M" A, g* e0 B. s6 H: O& Z( r//高度
0 U2 f; p) [2 o% i: {var marqueeheight=253 n5 H! v2 \9 z7 [
//速度(1-10)
4 q |$ q7 l3 A6 t3 rvar marqueespeed=32 g( |( N( D- Q% b0 @( v9 j
//背景颜色
4 K: B; d; f6 S! L# Z5 j; `var marqueebgcolor="#FFFFFF"* K5 J2 Y8 z1 F2 c
//是否能暂停 (0=no. 1=yes)?; i5 J2 W+ ^. }' c# s
var pauseit=1
4 q( u: u# r5 n2 x) H# f' _3 B; Z9 ^5 |1 f( }' r; ~ ]9 K+ G; b
//修改显示内容
& [) S7 t; J+ e- k/ v; m+ }: Nvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'* F1 T: o# `; W' n
8 @. ?* U- l8 E4 [0 I5 z& }4 u% _' {+ V0 F9 P5 C+ F
////下面不需改变////////////
, z1 S' T3 P+ M3 s
% x) r2 q% R+ W3 e! K0 }. l5 ?+ ?0 rvar copyspeed=marqueespeed/ H) J# {- N7 i% C/ T6 F. S
var pausespeed=(pauseit==0)? copyspeed: 0
6 ]0 X) n+ E; P" Yvar iedom=document.all||document.getElementById" ?8 V( r+ s6 A6 l& {
if (iedom)7 A4 ]% ~3 s6 n- t! H0 t: a
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
3 {8 R1 W3 s' o8 s8 M9 @! Dvar actualwidth=''! w$ j$ g+ E: A5 B
var cross_marquee, ns_marquee5 k# y5 l% C( w- V3 p D3 X
; e# r, L( o9 {- k& }9 \) b# ffunction populate(){( x3 _) _0 S! P- m% f |
if (iedom){+ q/ D. F) i" U& [/ C5 o& }
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee+ g1 p' Q) T$ m
cross_marquee.style.left=marqueewidth+8
7 _: d t0 ]5 F2 s) ^cross_marquee.innerHTML=marqueecontent
+ O0 C) P( u) z* f6 `actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
, {# Q5 T6 X% h ^1 _1 {; l}% d, V R, @0 e( [
else if (document.layers){
5 S3 {7 G* E" }+ c5 Vns_marquee=document.ns_marquee.document.ns_marquee2
& A! a) G I# e1 B4 s! F- V( W5 _5 rns_marquee.left=marqueewidth+80 O3 d4 d4 m" |5 H
ns_marquee.document.write(marqueecontent)( V2 E* j* n% \# k0 M
ns_marquee.document.close()0 X( R' @! W6 |7 _9 G
actualwidth=ns_marquee.document.width
7 R+ e$ |" ?# _- X}
1 h7 R! p. H% a) z; D+ o* Clefttime=setInterval("scrollmarquee()",20)
6 a2 K- f7 S# J) z0 b! b}
+ k1 [, Y8 B6 g- q( ]2 j2 A1 `window.onload=populate5 _+ I5 V+ Q9 T# a/ B
" A8 P; p" H8 bfunction scrollmarquee(){
6 q5 W* l/ q, V sif (iedom){4 d1 e" T4 X: Z& b% V
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))0 J; J' `3 p! ~% l3 q9 M, k
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed: b* T0 T; j9 H: C
else; I: w3 _- q7 A5 o) _. z
cross_marquee.style.left=marqueewidth+8! }. o$ E' z5 r
& c0 g8 E- ?( l0 M# O% g8 ]- a0 C}
7 u- O, S* u K& oelse if (document.layers){% g7 v! _7 I' Q- ~
if (ns_marquee.left>(actualwidth*(-1)+8))
! O2 ]6 R# k" Uns_marquee.left-=copyspeed5 T( M5 d! ^7 x% I2 S3 {
else
3 l' W7 n9 q1 v' r- z d2 {8 @, X5 tns_marquee.left=marqueewidth+8
& g8 c/ w1 {4 P- u6 t}" t' _1 g6 G/ V7 q7 L
}
" n+ c; M/ y) u% _8 u/ f$ S
: B% U- m' L: ~$ z2 xif (iedom||document.layers){
1 Y5 V _7 O7 k3 t- K; |+ rwith (document){! c2 a) N( t2 n3 M
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
0 ^% z$ H i. a% r# cif (iedom){
; e* @1 R. P% u: U2 Zwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')+ E; i. k2 M+ g$ d! G
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
% N! e1 R* W6 O3 H( u2 P! K: J& Qwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')2 H3 f4 N* Y" s: T
write('</div>')- u' \+ {2 C, u, }+ Y5 {* f" h
}" T+ I/ g: w* R) k! b
else if (document.layers){
7 N; V# F: n+ w9 K7 i' C0 J5 [write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')' V1 J5 ?: C* r" ?: M! ^& F
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')7 A4 ~) ]! c! G$ x
write('</ilayer>')
$ ^5 K2 b' \, r. K9 O}
, c" u- a6 ?6 j& {7 ^- cdocument.write('</td></table>')
# {8 j. N4 R N2 ~6 g0 @}
) k4 ~5 X) |# n% ]( V2 B}# o! L7 m4 ^9 D) J
</script> |
|