返回列表 发帖

网页之跑马灯文字特效

//修改宽度
) {# |. n9 p4 Q) s% zvar marqueewidth=300
9 {- O* }7 z+ y5 C//高度' a& E$ i* K5 C( {' {8 m# n/ N6 }
var marqueeheight=25
0 V4 r5 }: N; b6 w' D$ s" ]//速度(1-10)
8 _% s, m9 x, A# B( rvar marqueespeed=3, i% p; b$ P( ]! D  Z6 A) G
//背景颜色0 {) `8 ^1 P8 \5 x3 P/ _" T" S
var marqueebgcolor="#FFFFFF"
* P6 F, L0 n9 W, e; n. b//是否能暂停 (0=no. 1=yes)?! @) O; P' ]- q, z7 b3 B% ]
var pauseit=1
3 e. G4 t% \. o3 a3 ?# c$ c- P9 P" A+ i/ |" W. k4 ~
//修改显示内容- ^4 v, ^* i6 _+ i% [7 E
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'! r' _! c5 q: {& q+ h
; W+ A7 h" l% s$ D

. e& @/ f5 f4 o/ s6 [$ Y////下面不需改变////////////
0 t3 A9 T$ M2 L) r2 Y7 A3 X' e; i3 G
var copyspeed=marqueespeed
& A' B) w* e6 J* Y5 ovar pausespeed=(pauseit==0)? copyspeed: 0
8 q; d2 P' b/ tvar iedom=document.all||document.getElementById
" s+ P* x2 L: P$ n, a1 {9 \  jif (iedom)1 |2 o( l0 z) `
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')$ n3 B  ?7 O7 J+ ^8 _: q' P, E' j* j
var actualwidth=''
7 e/ H' \9 P, v) gvar cross_marquee, ns_marquee
9 D  C& L; L: |; {8 |0 Q/ D( L3 V4 {3 W: |% Q
function populate(){
5 ]7 B; r5 n& P5 ~1 c0 H9 m: Yif (iedom){0 ~6 n) d0 h1 f1 N- P; a" s3 o( {4 L
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee$ \" T) W6 s% W0 M
cross_marquee.style.left=marqueewidth+83 w5 \: D+ X7 @6 s( n  h2 s* |0 k
cross_marquee.innerHTML=marqueecontent. B- R6 b" h! M! z# i/ A$ b5 P3 A
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
0 O/ r! Y; O0 O8 c1 N# h% r! n}
2 ]8 B, L8 t/ r7 E% Yelse if (document.layers){
4 a3 C3 S& j( H/ N! Tns_marquee=document.ns_marquee.document.ns_marquee2
: l2 n1 x% M1 S# G4 j% Rns_marquee.left=marqueewidth+8* h$ t$ G/ ^; I9 W) a4 P
ns_marquee.document.write(marqueecontent)
4 \9 D) J7 U3 ^) Vns_marquee.document.close()5 g: |6 I" K: m& h7 @3 }9 X3 n
actualwidth=ns_marquee.document.width6 z& y" z! `* a1 e4 C# L
}' Y1 l- \% ]: h- \( {' l
lefttime=setInterval("scrollmarquee()",20)
! D% V) ]+ q9 |0 T9 Q' M}
. h% R) n! J& ~& u3 P* L9 D( lwindow.onload=populate
/ G9 Y* |( X0 v1 z9 ?4 X3 J) z. X$ X4 _* r3 c7 w
function scrollmarquee(){9 e- z5 H4 V4 p' ^
if (iedom){& L2 g2 s, {; E- E3 m( y/ j
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))* s9 I" d9 T' c# i3 m
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed. y1 {' o" R+ N, u# s7 ?
else% K& o* X2 C( W8 K
cross_marquee.style.left=marqueewidth+8
9 b( y5 n3 j6 ^0 z8 c, A! b6 Q) |2 H* ^9 I, K& i4 h2 E6 D  \
}2 e( d4 E( Z, D+ P- h2 V: t
else if (document.layers){
8 k' s4 n* r2 m9 Kif (ns_marquee.left>(actualwidth*(-1)+8))
. b/ t. C4 J6 C2 U' Vns_marquee.left-=copyspeed
+ y$ K8 [) J6 O5 Relse
$ N( c8 t7 f1 |* z  t/ H9 Ans_marquee.left=marqueewidth+8
5 [- `8 g8 O; d}
# ~' g: i, Q5 `6 Q. w. P6 p}
8 w+ ~* n. G* [0 w+ Z" c( d
2 b% l' m, R0 Y3 u+ s- b. [if (iedom||document.layers){
' I% b4 D3 H. C+ cwith (document){3 \8 J  d% O- r$ x6 x7 t
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
' Q4 m: T& z7 u5 m: p. {if (iedom){
* g; F! ~2 i+ R; O& M( wwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
7 r; V4 R6 {- }  O4 K+ f( Bwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
/ d! [, }: m: R% D2 {write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
) k3 V0 s1 a# E2 Ewrite('</div>')
: k; B( P- F5 l9 S}" c% |2 p' q! {) N7 W& t/ p" ~
else if (document.layers){$ B! k  p' ?9 L8 {3 o( Q) t4 x6 b
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
% H/ c# _; p( V8 \7 h" swrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')* t$ p/ v( i9 f9 P
write('</ilayer>')
" C" }1 e% C! W  W9 c3 O" r3 E}
+ G3 c! x/ R* |; ]document.write('</td></table>')# r; K2 y3 }+ o8 M; ^
}( C) M# c0 i8 v5 x* p" n
}8 z+ ^8 V0 w5 J* [! o; z: f: Q
</script>

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