返回列表 发帖

网页之跑马灯文字特效

//修改宽度0 S- W7 w8 ^/ b; Q2 L; r" j
var marqueewidth=300
  W2 X5 q! P* Z. C. i//高度
! T/ Q  m! }8 u: P/ B' W9 |. mvar marqueeheight=25
; K- T; p6 {8 L( I4 T: M. N' B//速度(1-10)
/ q4 `$ p& ?* \0 [" rvar marqueespeed=3
) U' }' C. @" C//背景颜色
+ P5 K2 T# ?5 M, s" I( Mvar marqueebgcolor="#FFFFFF"
1 x6 S' E. G- J0 u! y# x//是否能暂停 (0=no. 1=yes)?9 I: U7 k4 h, s+ j- G. o/ L0 X
var pauseit=1
. S1 H( X0 E- I$ j! g0 k: b' f$ X" r3 c$ y% p& k% l
//修改显示内容6 g4 j2 m0 V  p' F. ]: Q% e  B
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'+ [* ]' X9 |% r2 K, ^; f
8 i2 a; Q6 a) J

! r2 o* G# j. b: [5 \! d( |////下面不需改变////////////* u7 b8 K8 j4 u* L8 q! O

9 T0 b. Q- r; J2 b$ Evar copyspeed=marqueespeed
8 M% E/ \' S! A; Vvar pausespeed=(pauseit==0)? copyspeed: 0
. E0 f6 u# F$ `1 uvar iedom=document.all||document.getElementById. j" X: X; f8 J- b* J0 {3 \
if (iedom)
% T1 z6 Q' X8 p% T# V; Edocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
0 h) h: `+ L& w. O8 Avar actualwidth=''6 Z% y$ ?; n. H$ m
var cross_marquee, ns_marquee  e5 ]& a; q: u" K$ g. n& k

4 V3 z; j5 t& @$ v; Lfunction populate(){% d2 D! r/ P+ T1 C
if (iedom){+ m+ D2 N; \8 a/ O/ e& d7 H& N9 D
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee" q( F) X' U. j3 W
cross_marquee.style.left=marqueewidth+8
7 J3 P, w1 n! ~4 H5 \cross_marquee.innerHTML=marqueecontent
6 c7 |& e) v0 T- W) x; jactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth! ^' M5 }+ h* l/ H. d. ^0 b
}! \: w1 V: x# c- _6 q# ~- Z  N
else if (document.layers){( U( `" h" @; @2 _2 w5 ^
ns_marquee=document.ns_marquee.document.ns_marquee2
; U4 B7 [" {; B. Gns_marquee.left=marqueewidth+8
) l5 P1 A; z0 d1 d- L( ]0 ?) zns_marquee.document.write(marqueecontent)
3 i8 r/ r' n' \) {: zns_marquee.document.close()
6 b: q- E1 L5 @actualwidth=ns_marquee.document.width3 @4 f) i. N; G/ j  p3 h* ?( V
}
% I: E' [, Y5 x  {" ]8 u) xlefttime=setInterval("scrollmarquee()",20), \0 \( O. s! z0 o$ W5 V4 g$ R
}
" s& m& g4 F/ S( [0 wwindow.onload=populate
. e  w" J% i9 y# J, L
/ o  P0 u1 q0 Z( e# A$ I" L7 x; f* cfunction scrollmarquee(){
2 `, s* Y* ^# c/ d# e0 S; l0 Fif (iedom){, |9 ~& o8 T% u6 R
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
2 a1 C/ B: y0 _# G  c$ x5 |0 icross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed9 ]) f! P9 i3 C. C5 u) M! `1 v
else! {: f  U  ^/ m6 h
cross_marquee.style.left=marqueewidth+82 ~8 c3 {$ ~8 |% H( j

: F- Z& P2 V. C; q& ^4 D}
) |+ o2 G! u5 j1 |* X9 J: C- Relse if (document.layers){
, }3 _! A) p7 R; k0 }0 F! F& M8 Kif (ns_marquee.left>(actualwidth*(-1)+8))
# Q* x: Z6 y$ l: d/ B, kns_marquee.left-=copyspeed
" ^/ u9 x1 w5 n: V9 k. s  x, U. `else
# P4 T0 g( S( zns_marquee.left=marqueewidth+85 r" e: Y* C# G- T6 _
}/ Y/ I0 D# H3 ~8 D7 K* l
}
$ G2 y, {9 ~" X* ]. u0 R. Q: W, q+ h& P6 n/ M  B1 X: H; Z
if (iedom||document.layers){
4 v0 {8 W* v  o6 ^3 dwith (document){* L5 o8 o3 ~: i
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
% }1 a$ P( q1 h! h. J9 r, m0 \if (iedom){
8 t  O2 J' ]! H$ M' A) c- F8 Lwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
7 A2 z. P7 [3 Iwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')7 D# B$ s0 v9 M& C) a6 N
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
. I+ g& t; I- l% S1 ?write('</div>')
0 u7 x6 p$ t! O" s( v* V! X% P}
* ?2 a' s  G. k$ `  g8 C' n: Melse if (document.layers){+ P, C8 `' T7 x1 K. O# _) B& k+ x" V
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
5 K0 A" N/ ^  nwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')" u8 F" i4 b+ L& j! G9 z
write('</ilayer>')9 ^# B* @" Q; }
}& f$ i. z. B6 U4 J, b0 N. g
document.write('</td></table>'), P* B5 K$ O% v
}
* f! a! ]# T4 F/ b2 P7 X6 X. j}( F- {$ v( k$ B) O1 X$ C
</script>

返回列表
【捌玖网络】已经运行: