返回列表 发帖

网页之跑马灯文字特效

//修改宽度/ j9 `3 p2 R6 b/ j2 R& s
var marqueewidth=300
; {6 a( M/ E/ v+ O  b+ G2 X//高度/ e% M, A! I! b$ A- Q% Y
var marqueeheight=25
  a: ?$ Y% Y: f/ b" Q//速度(1-10)9 P$ U8 `$ ~' u: H
var marqueespeed=36 M* l: A/ S7 f$ v' {6 j, _
//背景颜色
' V( `' ]7 |) y1 L9 M$ ~# ?+ @( ~! {var marqueebgcolor="#FFFFFF"
$ j, E4 x( b. @' ?0 R& T//是否能暂停 (0=no. 1=yes)?/ p3 T7 L; P3 E0 t- g3 q& I9 Q
var pauseit=1
+ m& H6 z( Y  E2 W0 Q$ v/ R! B( Z3 d& U+ D* Y! B
//修改显示内容/ S6 {  X# i/ `* r2 u6 X$ M
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
0 x- W! S; t1 U  \7 }
0 }$ a2 K$ t9 s8 P6 v$ z1 l4 `* p$ w) X# R1 M
////下面不需改变////////////
$ O1 p# D- K# y) _6 _! X
6 m0 U. Q' V9 t7 pvar copyspeed=marqueespeed% V1 v9 d+ L; s( U7 x; T+ }
var pausespeed=(pauseit==0)? copyspeed: 03 e. c8 a! ]; h8 ^( L3 s9 R
var iedom=document.all||document.getElementById( Y3 L- k" A$ c2 W. w; |& ~2 t
if (iedom)
( _( e( y( j1 G$ {/ G3 odocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
5 `, }7 ~3 n/ v# x7 {6 rvar actualwidth=''/ S0 _  M- Q, m
var cross_marquee, ns_marquee
& L5 M4 ?; C. o
# S" Z' U7 o$ f6 o8 A' v& vfunction populate(){
# Y5 J7 P) J4 eif (iedom){
5 K6 E- g  }$ N4 N( ]! k6 t$ D. i3 n: Zcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee  a9 r% H( u; N& x
cross_marquee.style.left=marqueewidth+8
1 V1 a% q; |9 o4 ~$ ^: L5 Tcross_marquee.innerHTML=marqueecontent3 \* S; k8 C8 J: {1 H% k( ~
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
. [, U& I/ Z  h/ y& w  U" R}
( m. X. Q6 E$ v9 k  nelse if (document.layers){
( X1 g+ }& K2 S% `, V& ^: `ns_marquee=document.ns_marquee.document.ns_marquee2
/ k4 |! @3 a8 P* h) b- C1 @' M& Ins_marquee.left=marqueewidth+8
- ?% i. u; a. S1 S" |* }5 n# Vns_marquee.document.write(marqueecontent); |* |$ _" d; |/ s$ E+ K% t
ns_marquee.document.close()
3 S, [( b1 z& a# P1 r" ~actualwidth=ns_marquee.document.width, p. t" p* |: }6 i' z. _! Z
}. ]$ s- t# H/ f4 a! C7 T# q# K1 K
lefttime=setInterval("scrollmarquee()",20)
7 g, T: n+ B2 ^}& A4 {+ p5 N& r8 c. Z4 V
window.onload=populate
# I5 u: V5 x+ C/ Q& U; a2 O2 v9 d, T
+ C, ]& r) p  a5 U8 e' rfunction scrollmarquee(){
4 M$ B0 _$ _/ ~" {if (iedom){
1 H$ z- t3 A2 @6 a1 A7 R4 aif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
, o0 s: Q. K' ucross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed' V$ ~. C1 w+ D: V
else3 ^3 f$ A1 {8 c
cross_marquee.style.left=marqueewidth+8
3 S$ p; Y8 y" Z) `* ]  Q8 W6 S2 L3 h+ g* J+ f
}6 r2 }. ]; J1 q! _, _( P7 r8 |
else if (document.layers){
( T/ t6 X' S9 y& zif (ns_marquee.left>(actualwidth*(-1)+8))
+ T1 v& s, L4 A$ \. O9 e, _, Pns_marquee.left-=copyspeed
$ z4 g/ H& ?& L! F% lelse
1 P* y' a# F2 k  H) Z! e9 @4 J: ?ns_marquee.left=marqueewidth+8& z5 F; I5 l3 @1 `0 v" l6 c& }
}
: I2 A. b9 d2 x: x& R}$ U  |6 h& o$ u3 z) x

7 ~. p/ L9 B' r- y, t3 jif (iedom||document.layers){
1 |% A; _$ M9 A3 k% ~4 ~with (document){; z) J2 {, Q9 o$ F4 Q. ^8 j' b3 L
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')3 F9 a4 _5 Q  \1 M
if (iedom){7 Q1 `0 r! z* Z" K3 Z. ~/ @* ~$ t
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'). ]% E! V$ L, @7 I. T
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')( E4 s- {* G) \+ o. B
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
6 j4 T0 F- |& [% |write('</div>')
$ L" z; y9 d# f  u' M! q% c}% o; A( F+ c% a& \+ h+ P( z
else if (document.layers){
5 d: w8 y7 {. b- A' C% w' ]write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')6 r' u2 ~5 o( q# D3 h
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')0 g) S/ [1 W* I. a
write('</ilayer>')3 R7 R6 ]7 T2 }5 L# x8 a/ z# \" K
}
: O5 X- n# Y+ R  W+ ]- fdocument.write('</td></table>')
9 D! g. C# _, E# a+ h  @3 o}/ J* |* N/ h% g! E; _
}% r, l7 b$ t* x" }$ I! ^6 i/ l8 \
</script>

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