返回列表 发帖

网页之跑马灯文字特效

//修改宽度
* f0 Z- I5 c9 o+ ]2 b: {var marqueewidth=300; p- w' E5 d6 G
//高度! y  L/ G$ F9 z7 h: Q
var marqueeheight=25
% {- E, `3 X8 P" D) e0 `  Z: U//速度(1-10)4 v/ |4 g0 W  h% L* h' y
var marqueespeed=3
9 i  V( l0 @" c* s//背景颜色
3 K' G" i% }' \4 Y9 \6 z/ A) g: gvar marqueebgcolor="#FFFFFF"
8 O6 X7 M9 m+ R1 I+ Z! K+ w8 Q$ e//是否能暂停 (0=no. 1=yes)?
2 U3 |7 z% Z( G* t6 s; Jvar pauseit=13 K  x8 e9 p* e4 K% x* ?& U
9 d4 g, v* x/ ^8 G+ ~) j% K
//修改显示内容! @# M+ E2 L; m: \: A) o
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
3 n0 i$ ^: G9 O6 R& R3 i& B; R: t$ |$ L3 H6 \$ l. l
! ?( c- d% s7 i# A
////下面不需改变////////////5 d- f+ I1 M3 R! s2 c

4 [# y% R1 a  P) ]var copyspeed=marqueespeed$ l+ k  H: v. r) U4 {
var pausespeed=(pauseit==0)? copyspeed: 04 \8 C/ ]- d' s: A" F
var iedom=document.all||document.getElementById" b; s3 T3 Y: s5 i
if (iedom)4 P, z7 }2 [! y
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
+ p' K1 h# e& q" {7 Bvar actualwidth=''
8 K* X4 P2 o0 v3 O# N9 Kvar cross_marquee, ns_marquee1 i/ o, \" O# K+ r

4 ?" \' d& W& C* C, ]  bfunction populate(){! z& y5 Q' b" q& ]; x6 l7 O
if (iedom){1 {8 x1 e. B+ |- I( Z: D
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
# p$ _, P* p* j  Rcross_marquee.style.left=marqueewidth+88 g* Q3 ^( j1 G; Y
cross_marquee.innerHTML=marqueecontent7 _; m( o! Q0 `9 s7 Y# c5 k/ e8 [
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
8 F: d0 }4 M, q2 G2 H2 e3 k}
3 d+ }: O/ W) ]- J% m0 melse if (document.layers){/ |$ i+ S, Y8 o- \5 l
ns_marquee=document.ns_marquee.document.ns_marquee2
$ T/ S+ T, F) kns_marquee.left=marqueewidth+8* M$ j: K% F& f/ I
ns_marquee.document.write(marqueecontent)
, f4 Y/ Y7 J$ i3 u) }ns_marquee.document.close()
% C( i, A0 z9 n8 r3 g$ n/ Eactualwidth=ns_marquee.document.width2 C2 `3 U3 d* w1 |+ }* t
}. [& m4 N2 r+ z1 r+ C2 w4 I$ g
lefttime=setInterval("scrollmarquee()",20)
. A  m& x9 q) f+ y. m}/ p  }4 p( V- C$ \+ _
window.onload=populate4 o3 G: |$ `: t  C- ~

, c# ~; N; @6 u- |; q7 ofunction scrollmarquee(){2 q0 F0 ?' f6 ^8 q% o; n
if (iedom){
- A' G: p* {# s' Z& rif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
1 J# j( N& J: U8 c9 l, S7 j+ _cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+ _. }4 b) D8 x. g& d* R
else$ J; U. ?0 m& W. r$ o( E
cross_marquee.style.left=marqueewidth+8
( d7 e' Y! Y2 |/ ^. d" x8 `2 m& J5 [- l: \$ \
}8 b% ]6 n1 x& H& H3 r0 W
else if (document.layers){/ n+ W, |8 [# {* @7 R0 D
if (ns_marquee.left>(actualwidth*(-1)+8))
* C. t1 I3 }$ m# f& p* j5 U) I7 Pns_marquee.left-=copyspeed
/ d  M* _, W0 [2 Eelse' U3 K' T1 O, z6 I
ns_marquee.left=marqueewidth+8
3 e0 K% y0 M+ F9 x! A+ ~6 [}: \+ o0 k0 v) I7 i0 Q) Y  j" E
}
; W; V4 ?# T, n* G: n! Q& m- j" [( O& ?7 v% r  f- V: b0 o3 |3 w
if (iedom||document.layers){
. `7 A( Y) a% p, awith (document){# G% {( J5 Y+ [. l: L  I5 E2 R) [
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')5 X  s) A3 t, f3 e" @/ b- y/ D. N8 J7 s" }  V
if (iedom){
/ E# W+ _$ I7 |; S! C* iwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')1 m$ B& @3 \0 W; x! N3 k
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')6 a$ U# c7 S/ L- ?$ B
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')  G1 {6 @. Z- @/ V, y4 D
write('</div>')
2 B( {2 w- B+ \1 Q9 [1 }  A' O}
+ }( y6 k+ S9 J3 Q5 \, Yelse if (document.layers){
8 ~7 ?. x  M7 ~, D, u2 [write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')& ]* P3 T' ~8 S7 Q  t- i
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
) y% a7 I( ?$ P% T' I+ t# Dwrite('</ilayer>')' M( R; v) T" m9 d$ V: ]
}" }# w: m" H$ `
document.write('</td></table>')
' g1 V) ~+ G: C3 j0 }3 C" ~! S8 ]}/ s1 b6 Y9 w* y$ W
}
! r7 Y7 E  k$ b+ d3 {+ ^</script>

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