获得本站免费赞助空间请点这里
返回列表 发帖

网页之跑马灯文字特效

//修改宽度
) }6 T* {% t1 V% evar marqueewidth=300
$ ^& i/ B3 H& Q: N0 r. t//高度3 m% m1 U! ]& n$ m% G( j
var marqueeheight=25' b9 }0 O8 Y- ?5 R0 m; K' {
//速度(1-10)+ L3 y5 d" U/ W" @- \
var marqueespeed=3
9 b- x2 @7 w# q3 \) q* f. K//背景颜色4 n* ]) k" \5 Z% z5 D/ C
var marqueebgcolor="#FFFFFF"& Q/ A( O+ I' P- e1 I
//是否能暂停 (0=no. 1=yes)?
$ X! {+ W( \& F# a- n9 o. {var pauseit=11 j7 i, H2 F% j/ T

; r# c& m' ?- V8 `; q# U+ t0 d2 h//修改显示内容
" O8 m  d7 {9 n) r" M7 L- Y0 Xvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>': e' z6 Y, `# P/ c' r$ [% c" v  x
5 x! Z2 r! i& D
+ }' C4 M5 }6 v2 J- S# g
////下面不需改变////////////, u# L* j3 U* q
0 V" [% ^5 U; k% l; c4 m& H  G
var copyspeed=marqueespeed
0 L! ?$ k/ ~3 ~% H4 Nvar pausespeed=(pauseit==0)? copyspeed: 0. R! I! ?+ C& u) S
var iedom=document.all||document.getElementById
9 q3 u. \8 q0 I# c: `5 Fif (iedom)
7 k2 g: O9 {. ~3 {& sdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
3 V5 h! M( B! |4 |6 N9 k. Rvar actualwidth=''
1 ?: H" e( [  c! l1 b& q3 ^var cross_marquee, ns_marquee
, [9 P+ l2 _1 e+ V* l8 `* q) R& C8 m5 X6 M) W& C# r9 m
function populate(){
! p  i, C6 R( U% \6 Xif (iedom){
; e& z" @1 }. ]cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
9 x; O1 E: e# j% ]cross_marquee.style.left=marqueewidth+8
* t0 `% b: V: P/ g5 Ucross_marquee.innerHTML=marqueecontent
8 F9 m2 t: Q+ Z4 n3 W$ Bactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
& }" ]  V, ?0 L* B/ K' T' ^% e: T}
: f/ ^0 m" o/ i: h/ Velse if (document.layers){, G* i7 ?4 |- Y. E3 v6 t) P2 h9 ~0 V
ns_marquee=document.ns_marquee.document.ns_marquee2
6 ?- o: R" o* a+ Z0 p+ Fns_marquee.left=marqueewidth+8; _+ \: k- ^3 Y
ns_marquee.document.write(marqueecontent)
3 J) `# W: P6 B2 R# n+ Bns_marquee.document.close()
5 {9 A4 G/ {1 Hactualwidth=ns_marquee.document.width% o$ s1 D$ Q) ]
}* y$ O+ c6 ^, g) q" g2 u. V; o
lefttime=setInterval("scrollmarquee()",20). A: I$ H$ K2 H9 u4 r
}( u  U" R0 R3 @. \
window.onload=populate
9 E6 ~2 j- j  f: e4 f6 Q9 X" J* x2 V* r5 C# g; ]* u$ ^
function scrollmarquee(){* W7 ]9 O- Q* I+ G# o( Q
if (iedom){7 |1 g1 y2 u8 o9 ]* d" b( K
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))1 F2 R; S; j; X& A7 G$ f
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
5 i9 a+ V# ~& O3 ]& Eelse. t1 h) R0 D4 e  g, H
cross_marquee.style.left=marqueewidth+8
1 t/ X2 y' \- D/ x; P7 Z* s8 z6 e  u( h; |) ]
}9 b  i0 F6 P7 \; w4 U
else if (document.layers){6 P6 ]* ^, D4 m7 O1 b" h
if (ns_marquee.left>(actualwidth*(-1)+8))
" V. W! T( k, v) Z, j4 v/ g4 d0 ^3 Ins_marquee.left-=copyspeed
8 _# U" S! d0 w3 x; `else
; K4 Q: s" X* l5 z9 ans_marquee.left=marqueewidth+8( r2 K- D3 G  ]$ J" I2 n0 x
}8 i9 O: |- s" U8 C* b4 _
}$ M  N& \+ h( x
$ _+ [( a6 {. ]2 x9 V' X( b
if (iedom||document.layers){
( q0 H* h" a' H7 {  G4 H  Pwith (document){
: z3 B( w/ v7 `9 g; D3 t" n' Gdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
8 M4 A& Q6 m) o8 O# V' Zif (iedom){
# M; T! j8 L1 n! `1 A) Gwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')  ]5 U7 c  j# c& z7 l
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
! V8 l9 Z5 E& D" [4 }( hwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')9 d/ ?. \2 A' z+ s) O5 K0 Y  _
write('</div>')) l/ `) V4 w) `5 q
}
4 [* R+ s2 O: ^$ Felse if (document.layers){
3 R3 ?$ c% I0 y! ~# j6 O* Ywrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
) F% H! D0 ^. @. r: z  v& }* Wwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')# Z6 G" x! E' f9 E7 Z6 I: z
write('</ilayer>')
  }" }) B+ L# K, @6 S- O) Q) L}
- r/ ^% w. [. H( h% p2 Tdocument.write('</td></table>'); {/ K5 k" K6 P* g* d
}
- }- Z# f- B: D: [}' h  W7 S% }2 u, {4 ^3 |8 M
</script>

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