返回列表 发帖

网页之跑马灯文字特效

//修改宽度+ Z( E$ e8 u& o( l2 ]* U
var marqueewidth=300
# `/ p+ J+ `3 F4 `//高度
( {% J3 L1 m6 x. Evar marqueeheight=25. D9 L: w% x. s& d( \6 c1 d5 A
//速度(1-10)- W9 [% N' |. D! r% b- q
var marqueespeed=39 `. R! Y$ [  x4 F  L
//背景颜色
- P% e0 d: k' {; avar marqueebgcolor="#FFFFFF"
. e1 w. `# p( W0 V$ x//是否能暂停 (0=no. 1=yes)?6 B) J3 E8 m( [4 m' e
var pauseit=16 ]( v* a- |; I+ W( u
, o0 g" Q5 R6 q5 [/ ?5 e4 \
//修改显示内容
( |! I, T! t7 x2 V' uvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'5 Q7 L# a+ u: d7 L/ X" S( a

! N9 H2 ?: ?% _, o" t
, @8 F0 f  ^! U) Y1 C3 L7 R) Z////下面不需改变////////////- F7 \% u/ H1 J! E6 w
$ y) S* X, g2 `3 B- {. J' L  p
var copyspeed=marqueespeed# C1 K4 E$ }) R% U: E
var pausespeed=(pauseit==0)? copyspeed: 09 V: C# C+ t- d( y
var iedom=document.all||document.getElementById
) [; ]9 k/ s+ R7 r8 K: ^! _$ zif (iedom)
* U) e  `0 i' ~/ bdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
2 \3 l) k* T) ]% Z8 j1 hvar actualwidth=''
9 K0 ^8 t% {. q/ L# e/ Svar cross_marquee, ns_marquee
# {1 w4 y3 [; [$ j/ }7 B  @2 S
; c# p) y7 L! r5 R% i" m! X7 }function populate(){
) W$ {$ @+ u. {# L+ {$ U4 d& d" c+ lif (iedom){
' f* Q9 y7 P, Bcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee/ Z4 I4 m# ~; {3 q
cross_marquee.style.left=marqueewidth+8
$ J. l- N4 M9 l, s) j' Ecross_marquee.innerHTML=marqueecontent, n  L3 }2 M8 }1 a! Y( m0 W* Y4 ~6 V! G
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth! d1 P, s4 T) B' L' a! u# V3 y
}
0 Y& N) m; R% O: s6 `% ^8 l" ielse if (document.layers){
- w7 |: P2 I  C! g8 z7 Uns_marquee=document.ns_marquee.document.ns_marquee25 O3 ?' f8 F7 H  i4 H: j4 t% X( \
ns_marquee.left=marqueewidth+8
# p) ]$ ]/ q* S: U: Dns_marquee.document.write(marqueecontent)3 f+ ~' m: n$ K. C- ~( O" g
ns_marquee.document.close(); p9 ?( q2 O; W0 T( i* F5 K
actualwidth=ns_marquee.document.width) C7 h7 |& c! p( A. D) C
}- V% j* H) C- F" t) ^, h. S
lefttime=setInterval("scrollmarquee()",20)
& b4 U/ c; u5 U- k}- W/ I8 q/ M; d
window.onload=populate0 p1 p  P+ t) j" p& R
+ \2 C% f3 X! S$ K% i" T
function scrollmarquee(){" |1 _! H2 K, t+ d' V* R
if (iedom){
- w8 y% Y( M8 B' `6 {if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))0 O) U% _, U' e& N
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
) e* B0 o, I3 s  w' K# {4 @else: X: K  W8 \4 D5 k
cross_marquee.style.left=marqueewidth+8
3 P5 g" S! X5 b2 e& m( O
/ f" M- l% \7 {}+ B, _# D( J! ^3 J1 z
else if (document.layers){; \2 x! O- r' y: c4 V6 h/ F6 e
if (ns_marquee.left>(actualwidth*(-1)+8))
+ o+ V8 J9 F% n1 ~0 e# k- `ns_marquee.left-=copyspeed
; T* U# \4 l; o3 M8 yelse# |# |: W; D; T2 U( ~6 ?) r
ns_marquee.left=marqueewidth+8
+ i+ n' f  L: \) `" j}8 G9 Q! m+ o) D" T6 Y
}0 h$ a. Q- J$ H) n

5 `7 Y1 ]  ?! qif (iedom||document.layers){
. E" ?' G& k2 |7 K" Nwith (document){0 B7 y  @9 Y* \
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')1 T" z1 V) ?) W5 l# ?
if (iedom){
0 j0 Q% m9 U& i% q) Iwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')" V( L9 t" W8 n2 s$ ^7 K
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')4 r$ ?  Y' x" @, a" {
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'), u1 a/ C0 G& d, T; e4 f
write('</div>')4 S3 [( y; m5 t( f0 p% B5 e7 `8 Q
}
: C8 R7 w5 Q! X* oelse if (document.layers){
- z- Q: h1 y1 @1 iwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')$ l: E  r9 O! I& L% q! V6 B
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
( k8 }7 i3 m4 Y$ ]; Pwrite('</ilayer>')! `. r3 T0 h$ T# y
}
! f& U  I0 ]% k* V: }document.write('</td></table>')
% e+ J8 Y: l, g}, W3 M6 n$ M. ]
}% D" Y. A2 ^! f
</script>

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