返回列表 发帖

网页之跑马灯文字特效

//修改宽度
4 v% {! r% l2 Ovar marqueewidth=300
5 ~- M& U3 L5 h* U' u. Z//高度/ l8 _$ t9 ?- O* B
var marqueeheight=253 D9 b; y+ p9 R& R. w- j
//速度(1-10)
+ n9 `4 f- a* kvar marqueespeed=3
9 J6 s, `3 ]7 n# `0 T//背景颜色
2 q5 K8 E, ?! D. Q1 svar marqueebgcolor="#FFFFFF") ?' b' S( g' h/ `
//是否能暂停 (0=no. 1=yes)?
( r: b4 \1 P& s/ R: U% Nvar pauseit=1  f( ?7 W- S6 z5 }
5 G+ C1 p  I+ \" }
//修改显示内容; ]0 F7 D$ o) T) H
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'0 k/ M& m# F; S# K/ e: Q" R
2 c6 Y- t+ [, b

# N* W! W" x5 m: z2 m6 z) w; [////下面不需改变////////////
& z4 g1 \, N2 o5 Y9 i: o) V( F, f9 T6 T3 N9 ]2 q4 Y
var copyspeed=marqueespeed
, t" e/ K4 s2 G8 Uvar pausespeed=(pauseit==0)? copyspeed: 07 i6 i+ u- D- l' ~
var iedom=document.all||document.getElementById
  u8 ~1 m- F9 w7 _if (iedom)
8 @0 p0 O7 T# _: D+ D% idocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
; t: M5 ?0 T6 W9 Hvar actualwidth=''8 O* ]# @9 W- m) ^" P
var cross_marquee, ns_marquee
& \3 P8 b4 w" p) L8 F
- s9 |1 Q! S) r: O8 T* [# Ufunction populate(){0 _+ i% `. f* ?: d* Q
if (iedom){
4 C8 G6 i2 H9 C7 p5 Mcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee# s9 W+ E3 d; b' G
cross_marquee.style.left=marqueewidth+8* q$ g# l! A0 [0 u$ W3 K2 c
cross_marquee.innerHTML=marqueecontent4 A' M9 G! C* W( @6 a
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth0 Q/ l3 P4 \# n" w
}
' M! ?' n  o1 B7 L/ V! y7 V, belse if (document.layers){1 H1 t/ r+ O( _! r4 ^
ns_marquee=document.ns_marquee.document.ns_marquee2' O' X% X8 u7 _( f! F4 O2 z" G8 U
ns_marquee.left=marqueewidth+8
/ \! {6 G0 w. }. ^. M: f; Yns_marquee.document.write(marqueecontent)2 F% s: p6 k( K" f$ A; G3 e& O3 W1 U
ns_marquee.document.close()6 O, Q/ g1 X" K8 y% j4 Z
actualwidth=ns_marquee.document.width
, A( C' \9 D0 O8 G# A5 t7 v; C}* e5 g- C( W& m! s2 c
lefttime=setInterval("scrollmarquee()",20)
5 t. X" Q  ]5 d6 e0 G2 U}5 v9 D7 I0 C# Y! E9 k
window.onload=populate
- H* P6 Q6 J8 ^) c1 X7 }. G
; _! [+ h& D$ S8 F8 m1 tfunction scrollmarquee(){
+ J, k8 J  _5 Z7 V; j  I" G% }1 n: u( yif (iedom){
: F4 [9 _, _" W, i6 v6 hif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
$ k) Z, ^, }: ?* D5 x3 C+ @cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
1 V. u! G) v. s1 felse
8 [( K$ a& k0 G! N0 i+ K: Pcross_marquee.style.left=marqueewidth+84 Y! z+ }( w( j5 W
3 K* K8 A% u" s& W7 \. G4 ^
}4 X4 O! T, R- _& L
else if (document.layers){8 L5 P. s, n& z/ Y/ b0 d3 v
if (ns_marquee.left>(actualwidth*(-1)+8)). m- e0 H  w2 S6 ?2 w5 b( ^) p% s, e
ns_marquee.left-=copyspeed& Z5 X3 B; H  e  X' i2 p
else( \3 u" B) e/ k6 }  t
ns_marquee.left=marqueewidth+8# E- B/ Q$ V; s. }" l. O+ V, m
}
6 w/ ?0 G* ], u* B) F3 H0 n}
9 M* X5 _' p: H1 J) M$ ~* Z* P. ^% ]5 z; K
if (iedom||document.layers){, d7 y7 ?8 I5 E' f, B
with (document){  e" k" q1 e: T. |  Y1 s4 G
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')3 y( A% R, `0 D' N# @) a
if (iedom){
+ q) V& p1 n' c' `5 j& x0 W* pwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
" ~# M5 P! w0 i( ?write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
9 u# c8 Y3 D" F9 wwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')- W7 |3 p; }9 ~
write('</div>')* q$ e7 D7 U6 I
}: O! A- D! j$ w' n3 l
else if (document.layers){
1 d  K7 _  e: v( Ywrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')1 v; `  ^3 [1 |8 \4 E6 `# p: ?+ x
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')+ C, g* q  F$ L. C+ M
write('</ilayer>')( L3 {: [5 Y5 l) o
}, q: w$ g- T7 ^5 z* D3 m
document.write('</td></table>'). d2 x( D5 @# r- F* J8 w$ s+ v
}
& I' f9 N! T4 E; t2 `( V0 j, G/ }4 e/ y}# V6 @& d7 N0 d
</script>

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