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

|
网页之跑马灯文字特效
//修改宽度0 l( h" ~3 b/ f
var marqueewidth=300
/ N# E6 Q' S/ @0 k* T* k//高度
" c. C: @% h7 F5 e; i4 Bvar marqueeheight=25
! U9 O# o! [1 @+ |! t; l) g//速度(1-10)' `8 Z6 `1 R4 P$ @
var marqueespeed=3
& {; M. d5 u5 e; i//背景颜色7 W5 F2 {& L4 a' l0 Z5 v3 f5 @" m: D' r
var marqueebgcolor="#FFFFFF"7 ^; y/ q1 I& t) z* o
//是否能暂停 (0=no. 1=yes)?* ]+ Y! G2 a. r+ v: h: }
var pauseit=1* g$ V# ` x! B! ~' X7 j9 j3 Z* U! y
1 i$ U1 | i3 s
//修改显示内容
& R. Y" }* B6 A/ g) U( vvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
8 a! q* d& O/ }* F0 Q
9 a+ q# v+ x Q5 Q. O+ `! p% x1 p! b1 b7 N
////下面不需改变////////////
! Z8 u5 A1 O) r3 G2 V& }" q; K' D) r( D5 j# d+ b
var copyspeed=marqueespeed
* U" W1 ^% L' F2 C9 }var pausespeed=(pauseit==0)? copyspeed: 0
+ s' D! P- O+ _5 N/ M8 fvar iedom=document.all||document.getElementById! |$ e' I G# ~
if (iedom)/ a+ T1 m( o/ `. r& f& H" t
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
6 o/ v! p/ O( B) }; B- yvar actualwidth=''
0 y$ |7 D; b0 e0 e! ]var cross_marquee, ns_marquee
+ H: \# f( O! J* @" v# {
) I) j+ `" F [ r6 Y/ Q2 mfunction populate(){2 q) K: }2 K# S
if (iedom){
6 q# I" n7 {+ p) L m7 J3 v8 Fcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee6 k! }1 u6 `& d# w- _! d
cross_marquee.style.left=marqueewidth+8
# ?- `/ z/ `. {) jcross_marquee.innerHTML=marqueecontent
6 |' c& m0 l- j! O6 C' O$ U9 d) oactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
) d1 @) J' z" V7 B}
2 C$ {% E1 E- A4 O. p; L6 ?0 Qelse if (document.layers){
7 h4 H0 d9 w* z4 {" z" v) ~ns_marquee=document.ns_marquee.document.ns_marquee2- `) h4 h5 K* u+ m# B# ^( A/ O
ns_marquee.left=marqueewidth+8
+ C5 M9 T- ~9 H, w$ S) A/ G. hns_marquee.document.write(marqueecontent)2 h" q, D+ e% i: G* g5 M
ns_marquee.document.close()
( ]" |9 R3 o- L# [ W- Q* [$ factualwidth=ns_marquee.document.width3 ]' i0 n$ g6 ~% m0 a) |& [4 l" A$ k1 @
}
) c h M% b% Plefttime=setInterval("scrollmarquee()",20)
3 ?$ x/ y; b7 }! D}8 |# G2 X; Z: m0 a* R' d" d. I
window.onload=populate
( L& n9 G& K3 q; G2 x. j7 j2 k+ @1 `! }2 G3 z( g: A' _) i
function scrollmarquee(){
8 w/ E; b8 {/ Z3 T4 Lif (iedom){
6 i: l% ?; c, Bif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)). ^! D a" V0 J! R" D1 n
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
. `, m' F0 V: b8 r e9 [3 Oelse
# J7 l8 _0 t, N. C) W( \cross_marquee.style.left=marqueewidth+8
9 ^( i9 `* x5 C8 f/ W; a
' \& Y$ T) T& e- G}
8 Q5 H' _0 ~% s( U. o- \. ]! a B1 y) |8 @else if (document.layers){) W6 _6 _1 E; d8 z
if (ns_marquee.left>(actualwidth*(-1)+8))( D0 Z/ j" O: \
ns_marquee.left-=copyspeed4 g/ W/ W F. {8 J. i2 }3 ]
else
+ ` J+ S' q8 d0 Jns_marquee.left=marqueewidth+8
6 v9 `- c R6 z/ ]! p, G. R}
* c: z3 I' [$ A/ U0 _}
5 s# U& w* L4 r1 n% Q5 H2 h2 m* u. A% p2 k
if (iedom||document.layers){. L7 V9 o& w8 t- `2 f3 d
with (document){" |9 g1 g. x0 T6 r
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')0 M# E2 [: m, ^6 c/ w5 `- I) r# h
if (iedom){; e# @/ t, d/ k& i) m' L
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')! S5 y" _9 N$ p/ y
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
4 [3 ^) P6 \8 L1 gwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
\& W9 G% c' v2 N: jwrite('</div>')
% i2 Q8 M% |( z9 B, F}. D3 ~1 ^5 s$ G! F& y5 q' }0 ]
else if (document.layers){' P& r' U* @' l: T2 q3 d
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
* r2 y3 w2 j( l% Bwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
' G+ v5 \& b* }write('</ilayer>')
9 H! d+ D- Q) m! L. m; l, y2 J7 a}; O) V; ]9 V% l3 [
document.write('</td></table>')
1 x9 u% z& c) ?" E}
& T# P5 E7 `6 u' K}
3 W5 v0 {* H. T+ V, D</script> |
|