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

|
网页之跑马灯文字特效
//修改宽度- ?+ w, B7 }. p- L S7 j+ ~
var marqueewidth=300
a0 E+ v* ?. ^3 B//高度
1 ]% [1 h5 N4 F& k$ o: k- mvar marqueeheight=25
0 s8 Q7 H2 m/ R" l$ C: E8 [//速度(1-10)8 L+ o$ R6 M" ^: w1 V
var marqueespeed=3! ^) ^" l# \- V3 K; a9 J5 G X$ r
//背景颜色 K; i& {) o- v, z- x
var marqueebgcolor="#FFFFFF"
* G+ J" s! X, {4 {//是否能暂停 (0=no. 1=yes)?
& A* t i6 N3 ] `1 v' D" hvar pauseit=1
: C9 f; H1 }+ ~' m
: u/ f% i! L1 q5 A//修改显示内容' d" G- A+ e v5 h
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'! d1 N, n) k* r# E& \$ F
7 I8 r! k, a& u& p9 N- E. ~, q/ ]! M
5 F7 i$ y; \( S8 O c////下面不需改变////////////, w: X0 J+ I3 ]
% N, M, W; i: o; x, i. J2 H
var copyspeed=marqueespeed
" P) y. U) X0 i' s9 K. }! yvar pausespeed=(pauseit==0)? copyspeed: 01 o5 s/ q+ h3 i7 `" Y; j
var iedom=document.all||document.getElementById
5 [1 |% M: N$ ?if (iedom)
7 k: _% N% z d# [document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')5 L5 G5 P6 Y7 `: m
var actualwidth=''
- N/ O a( Z; `8 Tvar cross_marquee, ns_marquee
3 H' ~# B8 `5 A/ r9 t& s( Y3 y5 t+ v( v$ D/ \8 X% c# |3 g7 p
function populate(){" s. B& i+ T5 ]3 J% o
if (iedom){6 I& ?. ~/ `" N. j4 c+ a; J
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
4 ?* L h" X8 ~- g- `6 Xcross_marquee.style.left=marqueewidth+8
1 l3 o. q; h* m5 e' gcross_marquee.innerHTML=marqueecontent8 W3 p( T7 o& g
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth$ f) ?% j/ D" d* V0 T
}( V' M0 c5 B3 b" v M }6 k
else if (document.layers){) ?/ {6 h7 R- E/ t$ j% I
ns_marquee=document.ns_marquee.document.ns_marquee22 e( x' z1 l! j0 L6 w. Y. ^' h
ns_marquee.left=marqueewidth+8
9 D `6 X% I4 a, s4 w: W) ^ns_marquee.document.write(marqueecontent)7 M7 Z) m [; L8 G3 f9 T
ns_marquee.document.close()& U2 `6 h/ O" @
actualwidth=ns_marquee.document.width8 c; s4 k# I* W6 z
}7 ]/ S7 z0 C, E' c% O
lefttime=setInterval("scrollmarquee()",20)
9 y! C0 _4 D7 e4 M}
3 ~: z: x! k! Q. kwindow.onload=populate
3 i- Q0 Z/ i+ X9 ~" Z9 l1 \/ m5 Z( R d( h
function scrollmarquee(){6 y1 I! N0 X" N5 K' x
if (iedom){
$ y" f) f5 P* T; mif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))9 i" h" F1 K1 F5 t; d
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
' k# L/ t9 r5 P, Zelse- \1 n4 L9 t# o v1 \9 G
cross_marquee.style.left=marqueewidth+8
! X3 ?/ T* d1 n' w" k$ I1 g5 Y# m1 I/ [; g4 R, l
}( M$ r* m! G" u0 S
else if (document.layers){
# j) Q- T9 h$ s+ P, i% lif (ns_marquee.left>(actualwidth*(-1)+8))0 w T- }, j) _9 c' V) n
ns_marquee.left-=copyspeed! C+ @1 g. ^6 J1 Q
else/ D" M; E3 b( z1 r1 `3 }/ \$ H- [
ns_marquee.left=marqueewidth+8
2 ]. k' d2 c$ ~6 r7 B4 B}" q) c8 m L1 l- I8 k7 }- q9 I9 E6 m
}2 Z: ~9 G( ^. M6 m
: @1 Y- ^% U* K
if (iedom||document.layers){: W* S6 s2 A9 S: K2 w$ Z
with (document){) q. U6 c/ M [1 i9 l! W$ a" |
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
! y2 v4 D$ P( r7 ^if (iedom){% D2 B2 J. s: g! i! y* o
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
& [& Z' T$ G `2 _1 }9 ?write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')1 w6 Q3 N1 X- x+ {0 c
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')* n# u& j4 I) j. Q2 }. N5 x
write('</div>')
( g; i5 S! K6 X8 u}
9 i, X- j( H) A+ [ w: f( ?, Kelse if (document.layers){3 P% x, z2 }& e! H
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
' M) D9 S4 r! l' u4 Ywrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
6 K3 O) d- K ^8 p& Hwrite('</ilayer>')
: Z9 N8 C3 N a2 I2 O7 b0 _}- O+ t' S, D% F7 [/ E" P
document.write('</td></table>')
6 M9 J+ Z! k" s! k2 N# y}( |" {- z- V) i; t. b
}
0 H+ J$ Q' i- d. {0 n" u4 r</script> |
|