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

|
网页之跑马灯文字特效
//修改宽度
( R, f* ~, `8 P0 rvar marqueewidth=300
X0 n n5 R* y//高度$ M5 ]) g3 e( R5 y, F
var marqueeheight=25" C) @" y& V- ]: D
//速度(1-10)
3 G* e0 l7 i9 n# r0 d7 Svar marqueespeed=3
7 |/ D/ C5 n) ]9 S) O/ ~/ H//背景颜色
7 g+ a/ B6 ^2 d, jvar marqueebgcolor="#FFFFFF"
, y- o% C: Y% L5 k9 h//是否能暂停 (0=no. 1=yes)?6 j7 x2 I4 m6 |8 A/ t" j6 y
var pauseit=1
1 z! [. _1 j V6 d$ l% |) U5 m) Y) ?7 \; @: W3 g: Z/ E
//修改显示内容
$ ~' @# {" ?, S7 d' Dvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
' n" X- r1 @* O# Y) S! p7 y1 g. a$ l g4 t4 Z: k2 z
8 B' E. q6 A: D5 `3 D////下面不需改变////////////
% L8 {1 p8 W! W0 m2 w
" R8 [% u) Q6 h" h- }: dvar copyspeed=marqueespeed" S7 F$ m; }$ g/ Z9 \
var pausespeed=(pauseit==0)? copyspeed: 0; c3 ]5 ?* l5 w" _
var iedom=document.all||document.getElementById
( F( I B* b" K" Fif (iedom)4 D, a2 ]; q; b0 z: `5 H; X8 P
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
( ]3 [& n {' }" d! r* b6 J* \var actualwidth=''
" k' Q0 d5 F+ \var cross_marquee, ns_marquee
; C, P& }" E: e7 W/ k+ g! W1 w5 F4 W- R( \- k& R
function populate(){' l! P8 ~5 o3 T! V7 ~! N
if (iedom){
: P) r A4 y/ F; L8 B! G' hcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
4 p8 m# e( `- Q$ E) Fcross_marquee.style.left=marqueewidth+8
( @4 A* m! q/ b" l8 dcross_marquee.innerHTML=marqueecontent# z: X8 C- a K, R
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth0 E8 Q8 i8 P. Y$ @
}
$ T8 X- |9 A. a7 s' A/ b& w, relse if (document.layers){) o6 I( G6 t8 }" Z4 L
ns_marquee=document.ns_marquee.document.ns_marquee2
/ F6 a6 `' E3 v# C! s/ [" Qns_marquee.left=marqueewidth+8' C4 Q- z3 K; L# ^$ M( Q" K
ns_marquee.document.write(marqueecontent), o; I1 z; E& F4 ]1 O
ns_marquee.document.close()
; v! S. g/ @( I! J4 H7 I5 Z% k Iactualwidth=ns_marquee.document.width
9 X! X. }5 ^4 S+ _}
# x% ?$ t" k4 w" N% [lefttime=setInterval("scrollmarquee()",20)
* Z$ h$ z$ w& q% |' h6 z+ ^0 b4 V}
$ M) f( Y. x$ N+ m9 ]window.onload=populate
" k+ m" d1 W; {! |7 v8 z F# }4 ^9 [# d
function scrollmarquee(){4 f- c6 P9 U- ^) E' K
if (iedom){
; A* X+ A2 V( n0 A# Pif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)), }- _, K# ]( B1 R& z& {
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
( R. V7 u0 }6 V: W4 A1 C9 P; Xelse
; W- b" l3 G; m+ O5 t ^cross_marquee.style.left=marqueewidth+8. |! h% u+ k6 J; u9 {5 B4 l
( z5 v: `. p1 g2 m3 q: s' u}* ~. L) z3 C) }
else if (document.layers){5 v+ \/ ]& h. a7 h" i
if (ns_marquee.left>(actualwidth*(-1)+8))
, s9 l0 [* O- {, k p% Rns_marquee.left-=copyspeed
" ~/ P$ }" t0 ]else
+ l4 f3 m4 L2 `4 R; _7 _# cns_marquee.left=marqueewidth+8. |' X! E/ `& N3 [/ \# V
}3 Z4 R" n+ o# Z) A; _
}* i' s \: k% X2 |1 q: z
6 b& Z+ `( Z& ]* bif (iedom||document.layers){
3 C# C' H. M5 j$ M. b6 g5 R% ewith (document){
1 V8 O I% Q# c4 O" L. [# {document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')# d: A4 ~, m, f5 {8 X6 B* M
if (iedom){. b) K }: f* G6 F
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')' `7 e5 P( {4 T
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'). [/ N- s7 d+ M( ?0 _: Z$ {
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
3 [0 K2 L) G4 g' `5 c# _write('</div>')
9 L2 k% T* {. R1 s" I}% X2 f5 ^6 m3 b( |( y
else if (document.layers){
: d: P, _9 I7 u' qwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'); h+ j! Z1 z; Y; L' q* K" U
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
( @/ e6 o% L N$ G+ O; Lwrite('</ilayer>')
! Q: w8 e) e/ w' i! A}1 |8 n7 s: K4 Q$ e1 X
document.write('</td></table>')
5 o p+ h2 u" x}
1 Z4 ?, b6 X& Y* w& n}5 R; C( x* D y) u, }( o- ?
</script> |
|