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

|
网页之跑马灯文字特效
//修改宽度
Q, c8 I% E1 ~! n uvar marqueewidth=300+ B o' C) z/ L% F# a9 C7 r1 W0 T
//高度) o# T& f! U$ V
var marqueeheight=25' b3 i, ~: U$ W4 n2 B6 F. Q/ t
//速度(1-10)$ v. J& L! }! p9 q- [6 v- v! s
var marqueespeed=3$ I' T# y3 [2 L8 {
//背景颜色
$ n0 n* K0 c- G5 Avar marqueebgcolor="#FFFFFF". Z' G& t/ @3 G5 L
//是否能暂停 (0=no. 1=yes)?4 q: y7 c2 A3 H
var pauseit=1
+ p5 P8 a! O: u5 m5 Y- r0 t0 p8 |" _3 z
//修改显示内容8 W# O4 v% ~/ N! I# Y/ F
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'( e, a3 o# H( q- h& {# B5 E5 [5 _$ K
- ]7 W' j5 L6 F0 o/ r q, D+ R- } l% s# G( Y& n* G1 ~( T
////下面不需改变///////////// }* q1 h: _' Q9 n3 D3 l
9 g5 q9 x6 {. G+ i- T; @
var copyspeed=marqueespeed
3 H7 J' e" H; ?. a1 X- p6 A+ wvar pausespeed=(pauseit==0)? copyspeed: 0
9 A3 D6 E& b5 R% c3 s! Y; Gvar iedom=document.all||document.getElementById
\$ {- _2 l# x7 j) B9 Y8 U: w3 r9 d4 Aif (iedom)7 Z0 d1 ?& d. N) l1 c
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
( |0 D4 S& d8 j9 Q( Bvar actualwidth=''
9 s; f. r( Y& L3 _! ^: E& n3 Bvar cross_marquee, ns_marquee( |* w9 K% ?4 i z/ j% _
" o1 e5 w, S& d( J* X8 u' Sfunction populate(){* s! j* F4 P* m7 ~& f6 c
if (iedom){
% Y3 ?; O+ b! r2 o8 H5 tcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee& _; E' i! G& |' j4 O8 a; V6 Z' P
cross_marquee.style.left=marqueewidth+8* d+ R8 U4 Q8 z* [2 @2 p' _! C
cross_marquee.innerHTML=marqueecontent! X2 e5 i3 |9 @! Y5 i8 U
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth5 ]: \# g; a0 V' }9 p5 ~
}$ a% W L5 _" \9 U0 h3 D2 p8 k z8 n
else if (document.layers){
' J: O% ^% H. M2 Uns_marquee=document.ns_marquee.document.ns_marquee2
+ N/ ]& m. F+ K+ l9 R5 Z* j: }ns_marquee.left=marqueewidth+8& Y5 G; |' {( u1 I0 ?5 b
ns_marquee.document.write(marqueecontent)
7 R Z4 ~1 m5 gns_marquee.document.close()
: C& L9 q) t# H) \- D1 _1 Factualwidth=ns_marquee.document.width
, s3 k4 X+ o" r. U7 i$ e}
- ?1 M1 a* Q& o/ M5 Klefttime=setInterval("scrollmarquee()",20)
+ |* T4 S& \/ {: T8 t0 I, ?) F}' x8 }: H8 G# e; K% F
window.onload=populate* Z, u F. G5 p) ^( [" u7 P5 s2 L
9 I% N) Y, n4 F! l# F' ?) F Lfunction scrollmarquee(){# L( x" s d3 E( J8 Q. c8 k& n" R% E
if (iedom){
, t" |. z2 A% t3 Q% fif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))( K( L, z+ r" t7 @2 ?7 Y, Z
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
$ g2 Q1 L% x9 J$ b3 ^8 Belse" r0 h; y9 i- s% Y" J- K7 N1 @
cross_marquee.style.left=marqueewidth+8
0 G8 X& U: N$ p
+ i& S# R0 T+ \. x}! i2 [9 W$ C: O( B4 T: _. d
else if (document.layers){# k9 V* C. ~9 ~2 ?. N3 b' C: R, l
if (ns_marquee.left>(actualwidth*(-1)+8))
% N7 b, H; M' m z; E; q6 ^" \! Ans_marquee.left-=copyspeed2 B3 V$ B; F3 j8 S) ~
else, q; h z: r2 C5 l! ^% R: K
ns_marquee.left=marqueewidth+84 l6 j2 K6 L& r" V1 h
}
" M) o0 t; r- O y/ P( v2 b4 H, u}
6 m! O, B% k$ f( z d8 P
( d9 l+ ?3 q% pif (iedom||document.layers){2 s# @! h: L3 l" w& o/ a- }
with (document){
4 g4 x7 T2 d$ i- jdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'): E: L+ k$ w$ b
if (iedom){
( S" A0 x3 \7 \" W9 v; I L! x4 `write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')$ C; N+ \- x# g1 {6 v* t
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')/ G4 D& v; |( d" z
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')/ V% Y. d3 P7 H" y* H, P
write('</div>')
1 c* T% m" i# n} C, A" p& n% D2 }( s. `/ h+ L
else if (document.layers){
7 Z$ j' o5 |, d8 z! w1 x* Xwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')5 L: J# |$ x4 w! N6 I
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')5 u$ p: x" I! P4 b: @1 V
write('</ilayer>')8 r6 t" U$ S! G' ]/ X( \
}
) g$ I9 L+ [ \( i1 ] F! i; ~document.write('</td></table>')
; R8 k" k/ s8 {% T! B# D0 D}
! y) }# ^ w3 G% m$ b& }" _% Z) m}) K5 D9 }" [7 Y
</script> |
|