返回列表 发帖

网页之跑马灯文字特效

//修改宽度
% O) P1 g) L. t' D0 F" E1 g& Rvar marqueewidth=300
4 w' W7 s  ?0 ^//高度' p7 y% Y: Z  v! f6 a0 f
var marqueeheight=25
% S6 R9 E+ K- A  @+ \& \//速度(1-10)
. L' r2 M3 D* @$ F3 h7 {8 Evar marqueespeed=3; o) a" P2 R. \; y7 Z' R
//背景颜色' `$ M6 t. c4 R% C* t
var marqueebgcolor="#FFFFFF"% K: O# Z) h; _! K# w7 }( u. e
//是否能暂停 (0=no. 1=yes)?
  ?  s- |* k, W0 S7 Xvar pauseit=1
' i% e$ T) ]  y( \) [9 t4 m2 U6 m6 V+ N" q
//修改显示内容- D% O9 g7 ]5 `7 m/ i2 B4 o
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
) b3 _" i- g! h) C) I3 |* c+ c+ f, D5 e9 E* Z5 U8 M
$ e  P0 e3 z& r4 d0 Z
////下面不需改变////////////0 c  B& F& [# O3 L3 t3 J" |  q* J

+ d9 W  |0 Z  R7 K$ Ovar copyspeed=marqueespeed
, R- x; \; W- q. v# v* a+ Ivar pausespeed=(pauseit==0)? copyspeed: 0/ k) f% D0 Q( T5 [: q
var iedom=document.all||document.getElementById
& j2 |. j9 b3 @+ U5 Tif (iedom)
4 |* ?5 B; ?/ gdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
8 {- p" ~9 M* ^, W- E/ Qvar actualwidth=''8 Z0 C6 T0 M5 B9 k/ X( k
var cross_marquee, ns_marquee
* v$ k3 P) u% Y* |0 ?( M
) o4 `9 f7 H7 O. wfunction populate(){2 k" n7 r0 n4 \& J9 s) E
if (iedom){# F  o/ E. y! g! v1 O
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee( p2 [% j$ B% d
cross_marquee.style.left=marqueewidth+8! c1 b, `' [* C+ ^9 N0 @4 r, D
cross_marquee.innerHTML=marqueecontent
" V9 X% s7 F' Eactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth; b, f+ x) M# l  k
}
/ L. `* G/ J7 a& ^  T" lelse if (document.layers){
. d( n5 R9 T* I. G- o+ Xns_marquee=document.ns_marquee.document.ns_marquee2! A2 O: ]5 _1 D( [9 j
ns_marquee.left=marqueewidth+8
' s, p7 Y1 U% Y" X& S3 U  bns_marquee.document.write(marqueecontent)
- ?: v8 m8 @0 c% d8 r' J& S; Mns_marquee.document.close()
) I5 w. ^, ^( @: ]9 S3 H! m; Nactualwidth=ns_marquee.document.width
+ w9 j; D1 c9 |3 B}* ~! @0 D+ L* T- L3 ~. B
lefttime=setInterval("scrollmarquee()",20)$ C4 Z' n6 n0 E2 E5 m. X
}
' B. `' C0 A( ^7 M5 awindow.onload=populate
3 Z2 c2 G6 ^5 e9 t$ u6 u
  q" [: I6 ~9 n& A+ w0 L: H. Efunction scrollmarquee(){
5 K+ ~9 F; O; M/ Y; Dif (iedom){
" T2 l6 u, P5 Q; C1 `if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
7 v/ _( e5 d& ccross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
" g1 l7 [2 y8 e1 xelse1 E- s2 f! P% t- ~( Q+ h
cross_marquee.style.left=marqueewidth+8
& Z- i+ N" {) L. i+ s0 F' T5 Q$ B/ I- c+ q" o. B7 v; Z
}+ W. n$ z& n, F7 F; y
else if (document.layers){' P$ C' G, r: H: y& ^' _6 K" q
if (ns_marquee.left>(actualwidth*(-1)+8))
: t& B, H0 f. }; y# X. `9 `2 }' ens_marquee.left-=copyspeed, N+ d% q6 x3 a1 v/ w3 ^* m
else, E& m% l, C. ?4 j# M$ q- m
ns_marquee.left=marqueewidth+8
3 `0 s6 V: C( L# y}( z! f2 f8 }& Z7 N/ b! F  x: T& [4 x6 E
}9 r, t7 x) {( x; i: t8 e
" x) Y% a6 c- f$ t
if (iedom||document.layers){/ B) _: _% ^7 }: K' h) M9 Z5 ]+ o6 f
with (document){. L  V0 a4 Y; L0 j4 _$ L9 @5 `
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')3 m! ]8 I: k3 k  j6 H
if (iedom){
0 A0 K1 }0 {' C/ V, L1 d: j3 Hwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')) v8 v2 z! L3 N- L
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')9 N& [( m3 x3 N! [: C" v/ s3 r; ~
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
' z& H% Q5 t6 o7 bwrite('</div>')
' i1 h7 G+ M4 Y}
4 ^. Z3 p* `( x! eelse if (document.layers){9 c- a9 l, z8 X0 u5 g
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
" f4 F' {! k2 D4 y  |9 e9 S9 bwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')" r  q# `5 d+ D. v1 g+ o4 m2 f: ^
write('</ilayer>')
5 P( G" G' C" ]}" O5 J7 A# |# g4 r2 G& H: O+ w
document.write('</td></table>')) i' l. H5 _6 }( n  o4 u
}
/ ~) z% p8 ~- B+ g1 ~- c}% W' j  f: D2 `" V  ]+ R. j
</script>

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