|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度
6 T+ n( B5 ], k. @var marqueewidth=300
6 z" Z. i5 p# t3 f2 Y6 t) l4 q, k//高度' t# j5 C# F6 Z; U9 m- x, o
var marqueeheight=25 m) x0 c9 c$ F, H+ z
//速度(1-10)# y0 J% j x: m1 L' P/ A
var marqueespeed=3
4 b ^$ F, v: e//背景颜色
4 j# i, f+ i F4 j! ~/ d) p1 z$ Jvar marqueebgcolor="#FFFFFF"
* k3 e0 `7 Y# c S//是否能暂停 (0=no. 1=yes)?& g$ n. ^$ x; c& S( ]3 Q6 _1 d
var pauseit=12 n3 Q/ A B `3 T, J
8 U: S- o- l4 q
//修改显示内容
( k7 R+ q) t( q; s$ u& z/ _% rvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
6 g/ i8 l/ C" w" b, U3 n
* a+ u1 U- K, w5 d0 H4 r' o
( p5 M% y7 w/ k! Y3 F" w: G////下面不需改变////////////
: r/ P. m$ q# I# R, I3 W2 ~0 b c \- ]( {8 |8 S+ u, _* a
var copyspeed=marqueespeed& f y# @ b, |/ f( e1 B+ N5 r9 p
var pausespeed=(pauseit==0)? copyspeed: 0
: R1 B5 v7 m |* w2 ivar iedom=document.all||document.getElementById9 E& |: y; }4 _
if (iedom)
- Z6 ^- s' A* N `; h% x3 y% [document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')( u. B; \: `* m4 B7 E
var actualwidth=''3 n7 z& C" L9 H: ]& [* ?$ _
var cross_marquee, ns_marquee2 U) |- b3 N' o5 b8 n1 q& w) |
1 I. D; ]6 c, bfunction populate(){+ ]# y; z2 H M. v% g
if (iedom){& [; Z+ r2 K3 M' h
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
( h6 @! G4 ^: p# Q0 Jcross_marquee.style.left=marqueewidth+8
$ R3 G. L5 A9 Z, Ccross_marquee.innerHTML=marqueecontent
1 }. L, v$ o6 ?actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth! E- l% l, Z/ a5 F4 n
}- b! ?- F% q# k7 U0 P2 e$ m) W/ y
else if (document.layers){; v- x* r3 ^ S- K l9 h7 L
ns_marquee=document.ns_marquee.document.ns_marquee2
- J0 N9 L7 w8 i! v0 X# B# w; gns_marquee.left=marqueewidth+8
6 {4 M( D1 G8 ~+ Z2 T& Zns_marquee.document.write(marqueecontent)4 i% K1 p- h, u! ^ O) c& L4 {" P
ns_marquee.document.close()
$ ^, \8 E+ t$ H( o! qactualwidth=ns_marquee.document.width& [* v8 s1 W! [! ~2 L+ U
}
: C& }7 O3 M1 g' b% F' H9 |lefttime=setInterval("scrollmarquee()",20)
1 X( a. |! H% I- U4 z- M! ~/ {8 E}
) V- M+ _4 Z* q% W2 nwindow.onload=populate1 N& u5 ^( I/ F" T
6 ?2 |. `6 u; W+ z; A9 V
function scrollmarquee(){. ^' O5 @- {: X$ X
if (iedom){
?$ P4 @& Y8 h8 j3 jif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
) t8 Z$ g' ?' d2 x2 c8 H/ Z7 Gcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed/ h" H* q# h3 r9 Y6 w9 C
else
" a# q& z( u0 d% ?- U+ x8 z* ^5 y+ jcross_marquee.style.left=marqueewidth+8
; K( F9 C& s+ ^2 J/ U
1 O/ O9 S3 _0 Q. j5 a}& Q4 q; h% |2 v5 z8 G4 h
else if (document.layers){
2 k( k7 L: }& F. X6 r. Pif (ns_marquee.left>(actualwidth*(-1)+8))
+ A* }4 {/ e5 ?: y3 ins_marquee.left-=copyspeed
4 R* Z/ }/ c. Y+ V6 x3 S% gelse1 z! M- ~! u: Z8 w
ns_marquee.left=marqueewidth+8
; ` N, ~, H2 a* m$ K7 ^0 J- z}: t% w* ~. P M/ j( G: S
}0 m0 P D4 ~5 r
3 P- H8 Q5 ?, D+ tif (iedom||document.layers){8 [/ |: z8 }5 ^' g/ z) f
with (document){
1 ]1 Q% C% m/ H1 o7 a3 qdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
9 w7 f, P% \$ m3 C! r3 yif (iedom){5 D4 [- d* N1 b( |9 a
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
" `# G* G: z! m/ g% T+ }write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')( Y( g5 F5 _! R4 ^
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
0 S& j: ~/ d T- Q2 Swrite('</div>'): \6 F; g8 {% r1 c# `3 N6 N
}8 s+ M' \& s5 \) m& e
else if (document.layers){* {, n$ M3 J$ V7 C. [& w
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
; j+ r% U1 u9 Q# x( g& O( n3 k" bwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
7 V; y7 g# i6 V" q5 x1 |write('</ilayer>')
$ C( d$ x) @8 C$ V5 \8 m}
; K# d, j3 r3 e+ ddocument.write('</td></table>')
! z: t9 _5 e: j/ z w# P}
, j3 [8 S4 p8 r* j2 n}
* [. D0 J+ g$ Q- p3 w</script> |
|