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

|
网页之跑马灯文字特效
//修改宽度
# [+ ^0 e, D2 e% L2 hvar marqueewidth=300( r6 z5 s3 i# h
//高度& U( A6 `& `' A& `/ D" Q
var marqueeheight=25
9 l9 X1 s* a! E+ E) x+ |7 L. ?//速度(1-10)2 A+ t; I2 v- }0 w9 C
var marqueespeed=3/ k8 U) C0 V& q$ F( g/ o4 A
//背景颜色- j; \9 m0 m2 I: \
var marqueebgcolor="#FFFFFF") p' t! }. g8 Z! q3 w, P
//是否能暂停 (0=no. 1=yes)?2 B+ t/ L, ]( b) Y0 g& U
var pauseit=1 L: X) F. c8 \- j: ^4 v' q, C5 G
. O/ _* a# a5 `! @
//修改显示内容
8 ~- D: b" E2 ?var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
( e7 q0 I- h; w" P' n7 i0 `( }' K4 ~
- i. t" }6 H2 L3 G- c% R8 v
////下面不需改变////////////
& r& G- w" h. _! I: m* }" k8 U/ C: b$ J. n1 s1 j
var copyspeed=marqueespeed
, r' g5 Z3 c# u/ \9 O; Svar pausespeed=(pauseit==0)? copyspeed: 0
0 b) N( ^" n B" Ovar iedom=document.all||document.getElementById, m( i6 B, S1 t' G" c
if (iedom)0 U( W' k( L& Y( g3 ?0 R, @7 F
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
& |$ e) l4 p1 _, G. V4 Mvar actualwidth=''
9 N- W6 c0 Y# Q0 p' X6 g7 tvar cross_marquee, ns_marquee6 m! Y! ]) g6 Y7 H
6 v! B) w% r; S c
function populate(){
! ~3 K# V, t7 j" W9 iif (iedom){
- }" j% Z8 S8 ]* R; Scross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee9 W R0 w" Z0 m
cross_marquee.style.left=marqueewidth+8
+ S( |3 K7 Z% G" M! \cross_marquee.innerHTML=marqueecontent# s2 P4 G! V6 _+ x# J
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth3 J/ G( R1 y; _$ C% m! v/ a! E
}
, g9 u! t: W# d) t" j% aelse if (document.layers){
2 O+ M9 w! n! P1 g1 i/ S) B% Mns_marquee=document.ns_marquee.document.ns_marquee2
0 @! I0 x4 l4 l% ^) i3 N' {# dns_marquee.left=marqueewidth+8
% l) _5 n' U8 P+ q8 c' |& vns_marquee.document.write(marqueecontent)& ?1 ^4 J* q) j& ]1 [$ E6 h9 O
ns_marquee.document.close()
" \ c. B8 K/ Cactualwidth=ns_marquee.document.width
% X+ r- z1 f1 f, D) \2 s i" ]}
) |6 j% e$ K8 c$ m% v# n5 C' r# nlefttime=setInterval("scrollmarquee()",20)
; N1 W! Y0 ^ k! h5 g2 t}
4 n" U. S* X3 Y! bwindow.onload=populate1 ^+ O6 O6 z+ f6 ^" C$ R6 q
9 v2 Z5 A8 u9 f& ^- rfunction scrollmarquee(){, W& v& h& T" Z* I; g; L# x+ |! v
if (iedom){
* W% `" _, n! w0 D) `: Kif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))8 }/ {1 t1 w# N( A
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed E2 j; ]" M. I+ f6 Z8 y) C
else
% z s3 T9 L1 across_marquee.style.left=marqueewidth+8
! ?8 i* t" ~, }. G5 l) _' V" A) r1 [! }# F
}
8 y, W9 C& Q" q3 N2 Gelse if (document.layers){) \; M4 l. d/ V4 s1 W+ K3 z7 x
if (ns_marquee.left>(actualwidth*(-1)+8))
9 V' `3 b7 l, g+ }- ]* }ns_marquee.left-=copyspeed) j& f7 ^+ {$ f; }/ G5 f$ g; Z8 w
else
0 ^$ X; t/ N/ w" ?ns_marquee.left=marqueewidth+8
1 n( O. A( T, C9 f: M# I) U9 u, W0 A}
& u8 [" G$ W" L Y' `7 Q}4 \! @) d4 G8 o2 h V
# j! u; N' h) S. U2 E* Xif (iedom||document.layers){/ M5 D. l+ C7 e& f/ n; q* ~, L
with (document){
$ T1 } `6 x3 g4 t9 h3 x* i: @2 R" ^document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')# z% a* z) d& ^5 l0 C
if (iedom){
( S0 B4 ?( H$ j$ t# fwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
4 L% I2 M& u |; f/ f& swrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')( T1 o( x4 I. ^* G z) I' r! c$ J
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')4 M& O5 o+ c1 M) D% b
write('</div>')2 A( D' g2 t0 P4 V: |
}( H' g7 n2 T6 `" f" o: h
else if (document.layers){
. I7 t7 J* s5 _write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'); g4 J. A4 R" Y) g8 @4 x
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
) H. l* F: v2 F5 E/ I7 Twrite('</ilayer>')
, B* S) p) D D}
4 o2 t7 p, T$ ~5 c! Q4 Ldocument.write('</td></table>')* ~1 F/ u/ w* N
}
3 G" f. G' d: A: O1 \: D J% i2 t8 @}
4 q7 d* V* S3 x- k</script> |
|