返回列表 发帖

网页之跑马灯文字特效

//修改宽度. [: }- A1 r+ U1 C8 t$ f
var marqueewidth=300  c3 D# b9 B1 L) {0 N. D: ~
//高度% A9 W7 @. v, ?( ]. s
var marqueeheight=25
& {* A0 v+ T/ j" o//速度(1-10)
$ Y8 U: N/ `8 c5 r" o" A7 _* V2 evar marqueespeed=3
& ]. W" g0 L: q7 U& i9 ]6 a//背景颜色1 b0 M- o) e/ c$ H; l# L* ]$ z- y
var marqueebgcolor="#FFFFFF"; f5 J' T/ d5 A8 i- j" V
//是否能暂停 (0=no. 1=yes)?" U1 |/ m  O: x! ~" b# R7 d
var pauseit=1  o# w2 `( n4 V  x

8 i1 X% \- o$ ^% b//修改显示内容& r# L$ z" k& ^  X4 L9 u
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
  c. O* S( L! |: y5 b7 P. Y- `7 B1 D: i+ i4 L

; D2 {3 _6 K8 l. x) i////下面不需改变////////////- [- I) s) i8 f8 \+ ~5 u
! r- |* v2 q2 ]% C1 w3 a7 C  C7 y' w
var copyspeed=marqueespeed, S- P% L& z( p5 R$ h! Q8 |0 \% V0 \
var pausespeed=(pauseit==0)? copyspeed: 0
% f+ ?% e2 B" s( k  F7 o5 vvar iedom=document.all||document.getElementById4 k1 Z7 B) [' S) `/ y* K% D
if (iedom); D, n0 Y8 c1 O# S
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'). r, m! t6 X' E' w  y& K% `) s
var actualwidth=''
6 A  I1 u7 h1 bvar cross_marquee, ns_marquee
4 F4 Z3 S0 J. u" U) x, i1 x- K8 u6 \* m; `$ t
function populate(){& P; I  O* R4 a( f5 J
if (iedom){
& o( b' i% J- _" L1 ecross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
2 o0 S8 P: T: z) ]7 hcross_marquee.style.left=marqueewidth+8, g- Y, i0 D! G. ~6 h  z
cross_marquee.innerHTML=marqueecontent' a7 b( V7 X2 b1 \9 d
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth& U6 T/ O7 C5 y. b# u, H, i0 R
}
5 ~+ G. I& U/ w5 e! M3 Felse if (document.layers){
/ w" v  h2 X0 O( }8 k% U) z! Bns_marquee=document.ns_marquee.document.ns_marquee2
- F' s/ Q( r( ~ns_marquee.left=marqueewidth+8
7 A2 x* o% G; s9 ?ns_marquee.document.write(marqueecontent)( E; z* \' ?) A" \2 s
ns_marquee.document.close()1 o2 V" ?9 p6 `7 D# c
actualwidth=ns_marquee.document.width
" n4 d' z6 \% h5 U4 y}
* I  O- O2 \- L5 ~lefttime=setInterval("scrollmarquee()",20): W) e1 K4 X( r( }5 B6 m( T
}3 J" i: q' Y! x1 ]! X4 I9 Y
window.onload=populate
7 Q! K8 Y8 [9 E, n; Z+ L
. Z2 n; K8 O  e! T; \9 I$ zfunction scrollmarquee(){
# G. Z" i# C4 C! Y$ z- eif (iedom){
. r4 F( t7 ]& ?& X; H# K! jif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
+ R8 t0 S' `6 h* |7 r& N( across_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
  k; T) Z+ Z8 Jelse
3 }( u! v8 U0 C3 X: J6 vcross_marquee.style.left=marqueewidth+82 a& s& p4 t3 W; @
' T( t1 ]# R8 ?  I* B0 _
}4 ?& ?- B6 l+ Q# ?
else if (document.layers){
2 ^$ L- t9 A# y3 X' y! eif (ns_marquee.left>(actualwidth*(-1)+8))& p: B/ T0 ^& w$ b1 Q9 u* j
ns_marquee.left-=copyspeed% r% X+ O$ N! I6 j5 f
else
2 |  j& I4 D. i; Z, Q" ^) mns_marquee.left=marqueewidth+8
+ Q3 S$ O* [: J) D6 ~}; e/ b' i; b' h  Z6 X; v- G
}; K! F% K. p7 O

8 Q, y# N- d: c& eif (iedom||document.layers){
) s# W9 y# ]! [7 h/ E) u6 Q: W) }with (document){
; t, w2 J, j+ t! s5 hdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
( f! E7 d* r- j2 i0 ~: gif (iedom){
2 b# r: g/ k7 j+ n% B$ [write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')9 r, |+ S- {6 l2 S+ `0 f" P. f
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
$ o; ]4 L+ A- ?9 @write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'): {% E9 A- p8 ]: }
write('</div>')# {/ D2 k& ]/ @3 Y
}  q, e1 g( @1 E  e4 _7 O3 w1 _
else if (document.layers){
+ `1 @& y5 A# O2 k1 L' K: O6 Hwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
& h  B* k3 w3 Ewrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
( U; y+ E; m2 R6 _8 E" jwrite('</ilayer>')$ h3 C/ E8 |0 s, W
}. b& \- _1 s! H- C" L: s3 O, U
document.write('</td></table>')# u, B/ r1 R- x# x
}: U: f  V! u5 S' F5 y' e; B
}: ?, {7 I$ k% b2 M
</script>

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