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

|
网页之跑马灯文字特效
//修改宽度0 w2 p5 O; N# A
var marqueewidth=300
* a3 G$ A2 a$ B, B c% m3 ?//高度+ l0 V9 T h- p) b0 B
var marqueeheight=259 `9 B6 }; f& H* y; ^/ x0 W
//速度(1-10)
+ y, K4 H6 H3 C0 `+ P' yvar marqueespeed=3
2 @1 U- ?. E- Q& r//背景颜色0 x1 Q/ \; k+ X, e. G; L
var marqueebgcolor="#FFFFFF"/ f& L& l" A: g/ k" l# i
//是否能暂停 (0=no. 1=yes)?
4 q B/ k* l. l+ J0 F3 G5 gvar pauseit=1
1 y1 m+ G3 Q, W& A( }) W# d' Y0 Q" Q
//修改显示内容
; y4 n$ e7 ?5 E) f4 ]7 Z3 E3 T$ e( {var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
1 i9 X9 p# N9 S+ V3 A/ _+ g2 Y1 x0 g. \' H1 d
8 p3 u$ u# l, B. C////下面不需改变////////////
5 u4 r: i- N/ i
1 S, G4 Z* }2 i0 m/ a% ^* Dvar copyspeed=marqueespeed6 Y Z# D: M2 j
var pausespeed=(pauseit==0)? copyspeed: 0
# o, e9 l+ _ b J! l$ m3 K! V, \- `var iedom=document.all||document.getElementById" L0 h) f% m i# O
if (iedom)
. a5 j: A1 m7 |, i# v4 i) _; ydocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
# u. ^# Y) d' ?/ `$ Z6 qvar actualwidth=''
% @) t$ l+ \7 u* kvar cross_marquee, ns_marquee
* S/ ?5 S% Z" |. e" T9 a4 `. x( F* ]% z p
function populate(){6 {; W- b# p; ~ t0 V* s
if (iedom){/ s g. H, {! F* r2 K" {
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee! g% O' G0 g2 K1 t
cross_marquee.style.left=marqueewidth+82 w! @1 A% p( i) Q! ^
cross_marquee.innerHTML=marqueecontent
4 M1 }( \- t7 W d# K& iactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
$ B4 X6 D+ H: O( ^" o3 [}9 f5 t$ y# U' n6 g- E( f2 N( a
else if (document.layers){
% } E3 I4 c! V) W3 o) f; y" _" Wns_marquee=document.ns_marquee.document.ns_marquee2! d/ g6 g+ w+ Q w' C2 M" r
ns_marquee.left=marqueewidth+8
5 b9 u) v, L6 k* a* i2 H: Bns_marquee.document.write(marqueecontent)
v2 \4 E9 F/ D' Z' @% S/ G% Vns_marquee.document.close()
9 G1 K1 A( n# Y; ?9 Tactualwidth=ns_marquee.document.width
0 z& j$ ^" Q5 o5 `. z9 [; d}
/ O6 z' [! {. P9 \7 K$ ilefttime=setInterval("scrollmarquee()",20)
9 A! D3 S* m9 V' o* e3 n+ u}
: B3 b7 P1 q/ p1 p# q! o5 H6 zwindow.onload=populate
) f4 T. a; C8 U, k* d; r- c4 {% g- d. w1 |2 L3 k7 L& H
function scrollmarquee(){
9 U. n$ P3 P# S" L# |" ?& oif (iedom){9 R; O0 h( z6 O$ K
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)); [0 c9 O# d' g/ m$ v( n+ }! A) ?+ V8 u
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
/ U3 U- q5 W2 p$ m& \else
8 N) _* `& P. z* m( X! Pcross_marquee.style.left=marqueewidth+8
; ?, T8 y1 f7 ]( Z+ n! s" v6 ?* L( c
5 z! @. S( _% U; T: f}
& e( o0 A7 ?7 P- t( t3 Pelse if (document.layers){" M* f) @3 Z. f! k
if (ns_marquee.left>(actualwidth*(-1)+8))
: p! }7 @7 j, }# U* J% xns_marquee.left-=copyspeed* h6 o" i9 _" u" ^4 G" v9 y
else
4 A* X, E6 B7 [; Xns_marquee.left=marqueewidth+8, |1 N/ j! {" c3 H
}
9 q( K4 _/ r' ]) ^) v7 f}
5 W3 G+ b7 j* G* r7 W5 ^# W" R5 H. L! @+ w7 {; Y9 o
if (iedom||document.layers){4 U! Y. {. O* A' g; {
with (document){
4 H# L( o, [5 [" J- u# M6 H6 Ndocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
" M: c+ H, g+ ?$ q. @) c! h( \% Xif (iedom){" i) o2 h5 f( `6 E6 n
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
1 {! }. n- @. r, y& x; @7 ~write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
8 l( s& y8 p7 D. K( }. ^: |4 w4 E8 owrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')( ~! n: }$ i: M4 s
write('</div>'); |6 ?* V9 X6 `7 w9 l& A
}
; H2 Q& } b& m+ O8 Aelse if (document.layers){, _9 U' z- u2 y; ~& U2 H* s
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
9 B6 }2 |" K; R/ hwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')1 h9 O0 o1 _3 W
write('</ilayer>')
k; b x! y) v' L f W}
$ E% c4 @1 b* |document.write('</td></table>')0 T) [1 c0 U% K9 m5 ^
}: z2 c- X1 N, J; a; r( R
}
7 I/ \9 I5 o2 a+ z( o</script> |
|