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

|
网页之跑马灯文字特效
//修改宽度
y/ R& u4 ]2 O" Dvar marqueewidth=300
% x) v3 [; L$ T8 s//高度
9 ], `+ l( b; z" f, xvar marqueeheight=25, i' o; Z I% ?- R Z1 w6 R5 g
//速度(1-10)# g& z# T& i* u
var marqueespeed=37 j# e8 e9 @2 r) n1 ?3 T1 t$ K# W
//背景颜色
( U3 A: o8 |# t1 {/ g9 Zvar marqueebgcolor="#FFFFFF"
! l+ C/ K) S) }5 k: ^3 L//是否能暂停 (0=no. 1=yes)?
' R J6 Q+ t' k- ivar pauseit=1 J; w( i8 b% m1 x& w F7 Y
7 t0 \5 n& a8 o& E//修改显示内容
+ z. d" B5 r! c/ J. Hvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'' f; d8 d. }! D' [6 C/ [
2 C+ ^8 O3 o' u+ [- o3 H( V9 K- E( `; E# Q( ?* Q3 E
////下面不需改变////////////3 S% R/ |6 ?) E8 s Q; |' o0 t' q
* e$ o9 o% _0 ?& R: N' \7 gvar copyspeed=marqueespeed& ?! L( k/ V1 X, [) ]- I
var pausespeed=(pauseit==0)? copyspeed: 0
( ^( n* Q: z& F. v) `var iedom=document.all||document.getElementById
% ?% h4 a! Y* f3 {4 N! nif (iedom)
$ J% O3 V8 y* x2 bdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
% {4 z. I* U3 Y) Avar actualwidth=''9 @3 ~8 x3 z# s5 Y6 r1 E
var cross_marquee, ns_marquee2 q" m7 e* q1 d4 Z2 Q) Q
% G* R. i( P' E0 x, k I
function populate(){
# i) o* w3 L& ?6 V2 U6 o4 mif (iedom){7 z z2 X0 @3 J1 [7 n% c. R
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee3 \; A, A. H l4 [. Q( `. ]* ^
cross_marquee.style.left=marqueewidth+8: W' M2 m' p" _" C
cross_marquee.innerHTML=marqueecontent. N: ]; ~; p1 _; j; e2 P4 o
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth; b. g, p" e# A& v3 g$ Z8 l1 b
}' ]. o$ P, |8 I0 C: K# P; Q' ]
else if (document.layers){
d2 `: u- Z! Fns_marquee=document.ns_marquee.document.ns_marquee2; U0 f+ n' l; w5 ?- W# V
ns_marquee.left=marqueewidth+8" x2 T! R; r7 m% v% f
ns_marquee.document.write(marqueecontent)9 A* O6 a+ ~! n9 B3 q
ns_marquee.document.close()4 f% `8 d# ?) u0 ?3 W' v
actualwidth=ns_marquee.document.width6 y+ w% [9 f# i
}$ N4 Z! [# X3 S. R( U
lefttime=setInterval("scrollmarquee()",20)
- b8 |5 ]6 u& ?1 r}
: Z7 `. V( W/ s1 B; Z8 u( Cwindow.onload=populate
. u5 Q7 ]2 m0 T: a# a- B1 Q( O
: x( j/ T3 p5 @( w c+ Lfunction scrollmarquee(){8 J7 i$ R- T: M$ ?: G$ _
if (iedom){
- [1 r+ w0 {1 K( U: Z" _& T2 iif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))3 h3 x% B& q* a3 I* o- |. U# W
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed9 E% b8 b4 r, y, h8 {3 P
else# g8 { {3 ]* K( P9 l3 p' \
cross_marquee.style.left=marqueewidth+8
; x3 H h* J( h" ]% D1 q
. l8 R/ I& ~2 ?! y}/ C2 v$ D2 F* z+ d
else if (document.layers){
# y1 Y- J7 l4 C8 ?* e+ m5 K; t( \, eif (ns_marquee.left>(actualwidth*(-1)+8))
3 o& v+ T1 E# p" T) qns_marquee.left-=copyspeed, ?+ j; ?0 M* ~3 p3 P1 G* Y
else
# Q" t p) n. n- m1 H6 Y& o, \; U) m# cns_marquee.left=marqueewidth+86 s2 I. l3 t# s. @6 l% ^
}8 Z2 I( N) F, f8 S
}
! [* Q6 S0 D0 E3 x3 _) o# z4 E; L) F f g+ n
if (iedom||document.layers){
# _: _( {/ F$ M' h- k4 F1 J1 xwith (document){
' O4 x6 `2 U* P! [3 Q# V$ udocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')2 v7 `' A4 [4 u
if (iedom){
1 W; A m2 E/ }* r( ]* Vwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
l6 d- u/ ~7 ?( `write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')9 s0 ]; _; k' m3 F
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')1 ~/ K$ Q4 Z4 l# k
write('</div>')
2 B- W1 A' j" R, @}
0 L) U/ r9 }+ S) d3 ^ Belse if (document.layers){
& s9 l& C9 u$ A, a% Y* F( Ewrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')# D1 U. w6 d! s% o2 f' j4 C
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
, @8 y4 \8 A& D5 I) ywrite('</ilayer>')% T" g3 D: f+ \7 }, J* h
}
5 r; M: ~& c+ L; G- Z5 |0 e3 Q; ]document.write('</td></table>'), f. }/ [. h: d( [& z8 v
}
, z: \6 z6 W0 I6 ^% R3 q2 R}9 j# }+ y+ Q9 j1 U; G
</script> |
|