返回列表 发帖

网页之跑马灯文字特效

//修改宽度
1 N! C- n: D. w2 N' gvar marqueewidth=300
& ], p5 N6 q# z# w9 f* k//高度
9 ~$ h/ r, V- G: t' Lvar marqueeheight=25* i/ t" _; P0 T# Y$ R' g) x
//速度(1-10)% I- K0 W" j* O. ]
var marqueespeed=3
  m' w4 O4 p, c# b9 o//背景颜色. m0 J) [" V, ]/ z# i7 n
var marqueebgcolor="#FFFFFF") G" ]$ b( P) K  R2 c( S& y
//是否能暂停 (0=no. 1=yes)?
$ }) m2 |; X5 m8 kvar pauseit=13 E1 K! p: Y% o9 R2 h( |
( y% R6 @2 w, r5 Z; A
//修改显示内容: @+ k# i0 n1 D. D* m/ [
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'' L7 c$ O4 A% Z8 H9 V6 D

: ~: g( [; r6 h' A: q4 _5 M: B% e/ ?9 L8 P! ^" U: T
////下面不需改变////////////$ g2 R* c" f7 x
+ z( H" h7 ~; X2 l0 a
var copyspeed=marqueespeed- ?7 ^* R! y7 {$ I; b6 d6 p
var pausespeed=(pauseit==0)? copyspeed: 03 B: Z: l, T" T1 Y
var iedom=document.all||document.getElementById' t  U7 x* e7 P1 I* E5 p
if (iedom)/ r9 Z9 c# _% [# T/ t( P
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')0 W8 L7 k1 Y0 v1 ~' n. F# F
var actualwidth=''5 F+ ^  z/ x( r1 Q
var cross_marquee, ns_marquee. y0 E: t: |6 d& M+ m

6 Z' R6 s, {1 S1 W* e2 E7 a! Ufunction populate(){
( a* s2 A5 Y" J: p5 x3 Lif (iedom){4 H1 j5 [7 P  |9 o5 d
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee# `. T# \7 W: {) ^+ X
cross_marquee.style.left=marqueewidth+8' a0 W0 e; J$ p5 ]' m
cross_marquee.innerHTML=marqueecontent; p" g% C* ~) }" [
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth5 k  `9 @$ R. ^# ?1 T, p
}# y: `  \4 h" y1 Z
else if (document.layers){  Q* Y+ N& T8 M7 V# I
ns_marquee=document.ns_marquee.document.ns_marquee28 a( E" @; |. K8 q, b2 S) X
ns_marquee.left=marqueewidth+8
8 K3 C% I1 D- U& b8 Hns_marquee.document.write(marqueecontent)
+ G. d  \& l: t* ~" kns_marquee.document.close()
. c, h2 W; r' D- v: Cactualwidth=ns_marquee.document.width" E) N% P2 C4 h' Z4 E" Q: [& L
}
/ \1 X& s; b+ z4 Y! F( r' Xlefttime=setInterval("scrollmarquee()",20)
" _! X( _, q- G5 k4 h2 t}
/ z# p6 y- Q; d1 b/ m1 K0 ~' ^window.onload=populate
/ n9 M+ L4 h; C/ k: g( s) E
6 Q$ s+ U: J2 Mfunction scrollmarquee(){7 l9 S. M0 z# p5 p: p$ v+ K
if (iedom){- O8 v5 u7 D& d; N# C
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))# A" Z6 ]. H; g7 Q! J
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
" L: S  a7 l8 U1 P, helse
3 D* C& u  v2 @! ?cross_marquee.style.left=marqueewidth+8/ K  t) R  L% ^/ F: W# r& N
/ s) L4 N5 e9 Y, d+ i( M8 f
}& ~+ k6 o" J. y; }
else if (document.layers){5 P8 q& Z4 U2 T. J: _' ~
if (ns_marquee.left>(actualwidth*(-1)+8))
7 z0 w! O% E7 G& E* fns_marquee.left-=copyspeed* P3 J) o$ Q/ E
else' x7 j, d) @+ N" ]. m7 _4 C
ns_marquee.left=marqueewidth+8( u* Y; q8 O5 z
}( d, @- g6 H! C
}
" b( @; I3 A2 W# W* x: D- M4 k
- ~$ j' b# ~: M# _) L# `  Bif (iedom||document.layers){
- ~* X5 S) D/ `0 \5 uwith (document){
! a( x- |; b* o; t* j& D2 Pdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
; F5 x, M: P% c! p) Yif (iedom){
; N3 i7 N. E8 y% N8 X( J; W- ~+ Swrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')! i6 l* q5 d3 I" y5 t
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
2 @6 ]( R% w2 f& Z8 Gwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
6 J& F- \" d: [) S5 Rwrite('</div>')+ K/ ?' s- s* Q- Q, \& P
}( b' w* A; r6 }! I, C$ G2 ^
else if (document.layers){
1 M  M8 b5 Q7 n5 I# i) ywrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
* c7 F, {* [" c6 z; F) ^write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
! j  E, ^; ^, m- P/ z( n1 B/ `write('</ilayer>')
. J3 }' x# E0 m0 a}' D  M0 D( t, |3 ~& D  _. S- o
document.write('</td></table>')+ V7 E( n: d; G% D4 }1 I0 c
}( O7 E( P9 ^4 g. F: c1 Y  b
}$ w! c& M) d0 g3 d7 E
</script>

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