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

|
网页之跑马灯文字特效
//修改宽度
, V; ^/ v$ t" A3 |' `2 ~var marqueewidth=300
4 M# n) Q% M/ p+ T! F//高度4 F9 I! k/ F! X6 o
var marqueeheight=25
; _$ [- e6 c2 K* Y6 g//速度(1-10)
! W' O: P6 H/ U& Vvar marqueespeed=3
. l- U! |/ i' s4 R) y6 `( u//背景颜色
+ ^$ v9 @- D9 ~- ~& O6 evar marqueebgcolor="#FFFFFF"
3 _0 F" g0 Z/ D//是否能暂停 (0=no. 1=yes)?8 Q, q1 m$ t) r W- k8 G: D
var pauseit=1
# c0 j- d' D- h& p% q* q
/ U; ?) ?! I) D5 j' ^3 g& F: L4 U//修改显示内容
: r+ E. i& H3 \+ j$ zvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
0 F }0 e0 _+ e: ~8 q1 ~3 k1 T; e+ P9 f5 T( L' Z' ^7 O5 A
' a$ g* y2 k) @: g
////下面不需改变////////////
v+ {+ @. X( r" X# k/ ]1 L2 i
/ c7 i+ o0 z8 t, {4 e9 u2 Hvar copyspeed=marqueespeed8 \1 U( u' ~8 l! K& {6 W$ m, k: P
var pausespeed=(pauseit==0)? copyspeed: 0
- E n* G; b; I( {var iedom=document.all||document.getElementById
Y% Z) q/ Q3 Z" Nif (iedom)2 E6 d! q8 W/ ]' q# E& j* Z1 Z n8 C. A0 b
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')2 T- @0 S. V1 a* A- _
var actualwidth=''$ w& n+ O6 m9 V
var cross_marquee, ns_marquee- o! {# m8 c4 U6 D) Z
: g3 y! Y+ z0 i; E) \function populate(){1 X3 K, l; j- p* \7 e, V) R i% {, j
if (iedom){* x" J' h$ z; g3 _$ [
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
1 ` `1 \5 n5 K+ W6 ~cross_marquee.style.left=marqueewidth+82 z k/ U" Y/ _5 ^: F( Q( K4 K e/ i
cross_marquee.innerHTML=marqueecontent% y5 k% P6 _% S5 A$ D/ `7 o
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth. I( y+ `! B5 _; }
}" _. [+ }7 J" w
else if (document.layers){
4 F1 k6 e# u, g. z" q0 k M; K' ans_marquee=document.ns_marquee.document.ns_marquee2- ^& O! e" {% R% W5 g3 T: E
ns_marquee.left=marqueewidth+85 G/ C. O+ R4 g( e i
ns_marquee.document.write(marqueecontent)& s. x* j8 S9 M* m
ns_marquee.document.close()
! T: X7 W. X' @) E! p8 G1 Wactualwidth=ns_marquee.document.width
2 n# O& h7 k8 ]}- \ D( i/ _# f( R
lefttime=setInterval("scrollmarquee()",20)" Z3 w8 E9 N( h( b1 l+ T
}! U2 f: K f8 g, l# E* k& S
window.onload=populate
% T* @& a* t+ L, v" E, L- l# `! _* i2 m' [* D' i2 c' s5 _
function scrollmarquee(){
2 \/ m. U5 \2 ?- r; [5 T1 }2 O( D4 Rif (iedom){
, m) G1 t9 \9 S- @: K& N1 E; ?if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))' _" V L. d/ j1 g2 x8 ]
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
) @$ U" b$ }. Nelse
+ G! K- I1 U, D" {$ b; zcross_marquee.style.left=marqueewidth+88 u# ~4 r. n- U. [
8 T+ Z( t" S* J$ h% x
}5 A. h$ f# a }9 j6 T
else if (document.layers){- p) u1 d! O9 \' A
if (ns_marquee.left>(actualwidth*(-1)+8))) T- G0 d# i' O
ns_marquee.left-=copyspeed" A7 ^% [3 g* i* J; T9 t
else# t$ Y6 E. |* I' R2 ^' v
ns_marquee.left=marqueewidth+88 N; ]* N3 B2 B7 H& V
}
& W" x) b. P* u9 f4 r. t) _}& f- h- G3 J+ q7 t
5 J0 K4 S) h( I) ^if (iedom||document.layers){
4 @; e- G1 o' r9 U( ~' Swith (document){( c( R7 |2 w- O" C1 `0 H
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
# a3 j* d1 r$ y. g3 }, Xif (iedom){: f# {% G/ ~& I4 b! Z8 \
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')% P/ ^6 O J H. w* F
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
; y" i2 U" R4 H) \4 Y4 ^write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
- i1 w" w2 }2 v7 b- {" E, q7 Lwrite('</div>')# J$ h& C2 l; T' T; M
}7 Q, ]" n5 F8 u+ X
else if (document.layers){
4 x" _: z2 c6 C: p5 x% ?" O: {+ }write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')( ^! _7 y0 n+ e6 y! U; Z0 z2 `$ d( G# a
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
) F8 O5 L0 k* K3 n4 L6 h; e' J. Qwrite('</ilayer>')
" U3 u- _1 G, u. |% v3 p% J* |3 k}
C. B e" g9 b8 ddocument.write('</td></table>')1 n& f% X' N/ m1 G: m& P' E8 S: w
}
" F, z9 r4 E. f9 u* J; R}# G+ K/ s0 v' ^. h8 Z
</script> |
|