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

|
网页之跑马灯文字特效
//修改宽度
. c( O7 j9 ?8 K" @var marqueewidth=300
( |0 ?$ G' I3 n8 R5 d//高度' f3 m. b& _# d
var marqueeheight=250 g) R/ |! H2 ?4 Q# U( m6 q
//速度(1-10)4 K7 Q ?% l; I3 `
var marqueespeed=3% @: |$ `3 E# I" m
//背景颜色2 K; p$ _% I$ C; A9 G) _( K, D
var marqueebgcolor="#FFFFFF"; Y+ C* X8 X$ E8 N* Z0 i2 a$ i
//是否能暂停 (0=no. 1=yes)?
7 \. e: d) d @0 j3 ovar pauseit=10 z7 S6 a9 M! d" t
$ k' g! n% i- H( D( H, ~
//修改显示内容; f( N$ Y- |! `( v4 l% K9 Y
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
" \6 I8 t5 @* T" O- n& D8 s1 _: C0 `+ B5 Q
4 o: u' S* k+ n////下面不需改变////////////
6 _9 C3 C, O" Y5 P0 @! Y1 Z6 u& `, r g* I ~) M$ n
var copyspeed=marqueespeed9 @& n, k T9 I: m, w/ J
var pausespeed=(pauseit==0)? copyspeed: 02 K0 D8 P C& r* c y' }6 p4 K7 C7 a
var iedom=document.all||document.getElementById
/ r) d& O. k! n) S! Zif (iedom)
) l2 ]0 O/ k4 Y# Wdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')9 F0 J0 r) }* n, \# l
var actualwidth=''
/ ?/ S' e" t/ I8 T0 U9 b, y9 svar cross_marquee, ns_marquee
# {2 [& {- {$ R0 C" n0 `7 J" w; n+ h! a2 E# j
function populate(){3 d' c+ a5 K' Y) W
if (iedom){* D2 V; i( Q5 o' _2 O2 w) T, J
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
; |, ~& n+ g" J. dcross_marquee.style.left=marqueewidth+84 H/ v" g$ G2 S
cross_marquee.innerHTML=marqueecontent: P- ~# r! j- X7 I7 f8 v
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth* s" Z0 \$ O0 r9 N3 M
}
; n* N6 B& n* G. \9 G- celse if (document.layers){% _( A" E; B5 F% Q2 J& V H1 Z
ns_marquee=document.ns_marquee.document.ns_marquee2
' n) G: o8 D8 g6 {$ S$ C @ns_marquee.left=marqueewidth+8
) f2 D: N7 g* bns_marquee.document.write(marqueecontent)
L: s9 x; B9 T" b E, o8 Kns_marquee.document.close()
4 A: ?8 a; i3 j+ C4 {3 Tactualwidth=ns_marquee.document.width
8 a" u Q1 q& N9 b2 m" Y}; `% R- _% y* S# h! r; K
lefttime=setInterval("scrollmarquee()",20)6 W' q* h" u- s$ y" a a# X. I
}1 N# k3 {) {9 P( q: v6 W, H
window.onload=populate4 E) S3 O3 m( m9 o2 ?9 v6 l1 A
" l0 J+ L/ {( q, W
function scrollmarquee(){0 r4 i/ J( A. h8 V+ Y
if (iedom){
1 {& ]0 u* A, E: l+ V- kif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))5 R4 L9 `: F- D, n2 P
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed; R0 Z* o+ B7 r& I E
else
# k# q) v3 ?( v; mcross_marquee.style.left=marqueewidth+8* r j" A9 Y5 K8 [. k9 J
" ?1 t' E2 ?1 f/ |, u. ]8 v' Y% \3 u
}
7 |/ F7 A+ }7 yelse if (document.layers){
8 A3 k ^9 x+ z4 D. Dif (ns_marquee.left>(actualwidth*(-1)+8))
9 a4 g& I3 w- T: F1 K" N9 W& E2 R1 gns_marquee.left-=copyspeed
. q, F z5 d. u" \- N6 X* Selse
0 o" i1 i" O" Y% N1 [5 [ns_marquee.left=marqueewidth+8
9 E- _# \5 M, |}4 L8 @1 O _0 t% Y4 I% V/ b$ V
}
6 [& E% w. \) X) `# x, j! H+ Y1 h$ D4 j% b: C
if (iedom||document.layers){
3 s; H! I+ T" C9 f7 V/ }7 v9 Swith (document){
. z% W0 n. `; f! Hdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'); n. ]5 L X2 w
if (iedom){
3 I4 b a; g x; m( U9 uwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
$ F+ v9 ?4 Z4 R5 T# n3 dwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
" [2 l2 C) v8 m) Q! z( Qwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')1 O E: O. J4 `* o" E- U* d
write('</div>')1 G2 s4 C s/ g% T5 h' l
}
! O0 k- O: T0 B2 melse if (document.layers){
* ^+ a6 m3 b f2 q7 K9 i) `write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
; W' G. Q1 L# a' jwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'). j7 c7 J1 _. K5 U$ J$ c; ?' |
write('</ilayer>')% A- Q6 w. K; f5 j
}
1 z6 f5 `8 |$ [: Udocument.write('</td></table>')7 ^) e: T6 {4 Q
}
) v5 u# A- K. _, a% Q. o% F}
% e9 n8 y+ F$ L l</script> |
|