返回列表 发帖

网页之跑马灯文字特效

//修改宽度
& g' {2 O; }$ r# g; Lvar marqueewidth=300
7 c( b$ w; }9 h( r//高度1 [( E9 c  V1 ]' u; Y8 C
var marqueeheight=25
) A( @8 Z4 S( J8 l: ?//速度(1-10)0 x0 c- r) V" j; o& l. [8 O7 R
var marqueespeed=3
; G- z* A1 @: \$ z* ?8 w//背景颜色7 B$ Q, a: T4 A- W+ R) A0 y3 Q# D
var marqueebgcolor="#FFFFFF"* r, o# |" {6 M& F3 l
//是否能暂停 (0=no. 1=yes)?
$ ~( V* \6 W9 e: vvar pauseit=19 m9 [$ [% e2 P% q9 S) _! I

9 y9 S3 E+ `; [# \//修改显示内容
6 [, S, a/ W4 j6 W+ L+ cvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'; S5 v4 ]; A: ^, [* G, n& E( G
# T# `/ E9 V3 M

- G+ L* a7 I' k( q////下面不需改变////////////
7 J- J: v# ]' Q) A! f; K" c1 K
var copyspeed=marqueespeed( h& o/ Z' K5 d9 k4 B+ m( b
var pausespeed=(pauseit==0)? copyspeed: 0
3 c4 Q0 X% k4 s/ R& evar iedom=document.all||document.getElementById5 Z7 Y5 n* Q$ B' g" S# D5 x
if (iedom)
8 s9 c6 _1 l" A( @3 D1 L- Idocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
& G2 u! k: c* R7 i& D$ qvar actualwidth=''4 t- S$ z8 Z3 E! h& r
var cross_marquee, ns_marquee; r3 P7 u3 g4 ~# P) C" C
4 O/ K+ U9 U+ @& A
function populate(){
7 R, d  D! i3 X* g  b# ]. Jif (iedom){5 y: y4 r! Z# }# Q/ O0 V9 J
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
1 B/ f( R9 J( T1 \, h% [3 pcross_marquee.style.left=marqueewidth+8
* i% C# g7 l1 r- A) a0 {cross_marquee.innerHTML=marqueecontent: Q  a) I: c' K3 q" q4 ^. F
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
! R8 L% o/ s6 ~' C: b( B}" s; n( `( z9 `+ {0 h& ^5 H5 R
else if (document.layers){; n8 |( a* E% z
ns_marquee=document.ns_marquee.document.ns_marquee2
2 c2 T1 K9 X3 H6 yns_marquee.left=marqueewidth+8; y6 u& H0 A! N
ns_marquee.document.write(marqueecontent)' s9 E% _. t; x  ~% A! }* u" L
ns_marquee.document.close()
; L- f9 U! Q2 d& I/ tactualwidth=ns_marquee.document.width
9 n* S6 L% {7 B9 O' k) W5 ]  \}
* B. }& [- \2 h; {2 d7 b$ ^( mlefttime=setInterval("scrollmarquee()",20)1 C) s% b* Z, A. q$ y5 c5 k1 K
}
& k$ v% @/ T9 @window.onload=populate
( d: ~2 B2 q: Y" G: J( ?0 L) d3 b0 I; V# ]* X
function scrollmarquee(){
: Y, A( _: N. a+ Q' B! ~; S" }* L' Pif (iedom){9 U, i8 c, T% d
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
, {0 s- f# o- [6 C, jcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
" ~/ I/ F$ [" Relse
. Q) q8 W& i( k; ?& S( r5 q; ?cross_marquee.style.left=marqueewidth+8  ~8 O% w. h/ V9 @; x5 B

  I& s" s+ _: v. m$ V}
+ n9 n# U' w; Telse if (document.layers){' w- u# k% s1 L9 @7 `
if (ns_marquee.left>(actualwidth*(-1)+8))
$ j, f* ^" q) ?, q: _ns_marquee.left-=copyspeed
$ q9 ?) h5 M$ t6 O0 Y# o* W5 e6 Welse" ?1 v/ Y8 @, ]$ X$ U+ O2 m
ns_marquee.left=marqueewidth+8
9 [, K7 x5 ~6 U}8 i) d: y  g; D* f: t5 p* O' H
}
3 M0 f. @% D" t* L
5 E( T+ @$ N; Z; v4 V7 t0 zif (iedom||document.layers){, @1 [  p: Y$ r" u0 i  n: G
with (document){# `0 q# s; _" d
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')  @/ c) o5 t1 \; Z+ q
if (iedom){/ s' A/ E7 N1 O. |! r7 ]
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')# |  o3 K+ a8 {4 c+ L. g. O
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')$ {' w" h7 Z. h: P  Q. h! q
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')- @% e7 t2 Q6 F
write('</div>')$ G1 u6 E" R: T. Q, w& o6 w; h% j
}  T4 y, U3 y  N, L0 n
else if (document.layers){  b8 \1 M! \7 G  m' k
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')! a4 H5 k  w  B" b
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')% _3 G, g5 D8 j9 h0 y6 L. Y. |
write('</ilayer>')
: n0 A# Y( p0 `  b}
) S) H7 C2 c$ y- Odocument.write('</td></table>')0 U) g% z! W6 i* k$ q5 y
}! s3 H* p+ g2 [
}
; w) b. q8 x, i2 B/ ?( x</script>

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