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

|
网页之跑马灯文字特效
//修改宽度
8 g" \8 B1 s- V" nvar marqueewidth=300
. w, f/ y/ }9 M4 F$ m//高度
7 W) e# k# ~. Qvar marqueeheight=25
+ T/ v; S4 F$ T# _9 R* h//速度(1-10)2 f: ^( R. k! _1 `, z- [1 m0 `
var marqueespeed=3. f1 }' L. h2 ^; L7 V
//背景颜色
; m6 j7 G8 L/ `& d3 k6 P7 xvar marqueebgcolor="#FFFFFF"
% y. S2 b- h3 s9 M//是否能暂停 (0=no. 1=yes)?
3 {1 w% q, C" n; \" D4 |7 X$ ]var pauseit=1/ O# ` U8 B/ F$ U$ p* y9 d
$ D7 _9 }. ~+ b0 ~" u) c//修改显示内容
8 z |' l" r" j6 b* p$ Xvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
9 h! C |) r7 `* u
! k" E$ ^ n$ y- w0 m3 G- ]# N& \) M: g8 d) M1 @0 A( ?
////下面不需改变////////////
$ u3 j/ Y/ x) Y0 R2 B( [+ \7 |4 F. a2 X$ {
var copyspeed=marqueespeed' F6 Q6 }9 K4 J
var pausespeed=(pauseit==0)? copyspeed: 0
. }9 X" t+ U+ w. w# cvar iedom=document.all||document.getElementById
' V7 L% j3 w8 ~2 l3 P% Z. \6 Nif (iedom)
+ a( `, H2 O* |- S& l4 udocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
/ u% m8 |0 A+ ~- X: a- L& j# cvar actualwidth=''
$ t, p" X3 L ]1 o7 _var cross_marquee, ns_marquee' a) |! q6 h, }+ K# {8 ^. x; i
$ |, s0 u. n; C( z6 E. ^9 y
function populate(){8 z- [7 e/ O; E$ r& A! t: L/ z
if (iedom){
$ a8 w: R E- H. \. rcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
. m, `3 ^( R% |6 i. u' E# qcross_marquee.style.left=marqueewidth+8
9 }1 ^8 \8 Q5 D$ ?4 J9 {cross_marquee.innerHTML=marqueecontent
5 m. I8 g% `/ j% j Q. }. W# ~actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth: t" j3 W$ N9 D5 \0 N
}5 B: E; A% ^0 h4 |2 n
else if (document.layers){; t, A5 \9 U0 K! ]) Y$ ^
ns_marquee=document.ns_marquee.document.ns_marquee2* r& i- }! ^# J0 P" w
ns_marquee.left=marqueewidth+81 u$ [; e P B, B
ns_marquee.document.write(marqueecontent)! S4 X& w" V. t; ^ x' U: H
ns_marquee.document.close()$ S8 R ~& @1 T6 A) K3 l0 O# ~( e
actualwidth=ns_marquee.document.width6 w# t$ V! t- y. G2 i
}
: `5 V; G* @) ^4 N% ylefttime=setInterval("scrollmarquee()",20)
! `. @; N# v+ C! S: [& @}
9 ]$ s0 U. h$ C2 o4 G) A+ nwindow.onload=populate; B6 f: P8 Z2 W1 W: o& H2 I7 H8 A
" f( F% c1 o- N4 w5 e# }: W' r7 Z
function scrollmarquee(){
8 W: ~# f2 S) H6 U! r& Z- aif (iedom){
, m% f' F" \1 v! ^: O# Aif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
2 |0 o8 M& y5 V3 ]% x8 Ucross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed/ ?1 ]" g; D' J4 Z
else1 K, G: i" g: |$ m1 v
cross_marquee.style.left=marqueewidth+80 Y- f& Q* K6 L0 p7 t; E
* u. B: ]) W l- c `; x3 Z}
# _/ N8 T: g" B% A' Zelse if (document.layers){
0 i6 ?% g' t. V# F$ i; y% J# Xif (ns_marquee.left>(actualwidth*(-1)+8))
5 R" ]4 E; d/ {* n4 \: Ans_marquee.left-=copyspeed* b0 t$ s) Q7 I b3 m3 M% p
else N7 D7 q- Q$ E* d: ]# D* U" R
ns_marquee.left=marqueewidth+8
! B ~/ }( C- M7 U; g}7 o7 W' N' y0 |& \9 T
}
- T1 @0 x- y- L' J9 p
8 H+ ]7 F B- D/ Vif (iedom||document.layers){! w. k3 O3 ^: T! X+ |& _
with (document){
+ R ~: C S/ M: G9 Vdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')" d; W) h! v5 Z& ]+ t. u# v, A
if (iedom){
& {* j7 V3 {9 f; A+ r, O5 s9 @8 mwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
* W) {& ^' i( |% b/ qwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
" m+ f1 ~' G1 A) Bwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
6 E+ A6 }" @% P hwrite('</div>')
3 i7 l) D6 P8 ~: w- d}9 F* G$ }# d( K( Z
else if (document.layers){' ?' _3 B; P" D) s% y0 w" S
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
9 T- S/ i, S1 x* ]2 }( \( ?write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')( W2 e0 G! \1 }' m' N+ J/ X2 s
write('</ilayer>')
$ ~ G8 Q$ s* K4 |}
2 M- q! q4 D. kdocument.write('</td></table>')
6 L& m0 t% i$ \% k+ n}
: [& n) n7 f; J+ Q* |$ N- ]}8 R z4 D+ Q/ c6 @9 Z# i) o
</script> |
|