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

|
网页之跑马灯文字特效
//修改宽度
* `5 x1 }& l) Jvar marqueewidth=300
+ u1 D' O' |! D$ N1 z- h//高度" r6 `* k/ R5 Q; M0 ~, q
var marqueeheight=25
. @8 w# L" G: ], }//速度(1-10)! g' D6 V% B# N9 O. L Q
var marqueespeed=3
' }6 D# r* `$ V L# _4 s# r//背景颜色
) g/ O2 @+ A2 j; ^5 `var marqueebgcolor="#FFFFFF"
. k& o/ ], \! e$ @( `4 u# {//是否能暂停 (0=no. 1=yes)?5 @8 d7 e/ S m
var pauseit=1
1 ~, B! Z1 r9 c' O& ^- L' h9 U, P0 _' s. i1 ~
//修改显示内容
. v2 ?! _) t/ k( svar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'2 g! o7 M; H0 Q3 o
- O) W5 E) h7 b1 ~" }
( p$ Z! O0 y" i/ z" t1 @- n0 d////下面不需改变//////////// C' @0 ~8 ^* }$ c) N! X f7 a
3 X+ o* E4 w0 N3 O( Ovar copyspeed=marqueespeed1 _( ~" V- g/ W! x: V
var pausespeed=(pauseit==0)? copyspeed: 0. I7 H1 H" E4 ]
var iedom=document.all||document.getElementById
( ]$ |& y* N0 O' Eif (iedom). R8 _$ V+ E. h8 g: j( p
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
% |- D* |4 W" g! ]7 |var actualwidth=''/ F) d ` F: a ]( d# t/ f
var cross_marquee, ns_marquee
2 t5 Q2 B* n B' f% @; M* Y! H5 a6 a- }; R
function populate(){0 P0 O: g7 | e9 P5 t( N
if (iedom){
6 @: j3 }; C7 b: Rcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee- ^ L+ ^) Q- R& g: ]
cross_marquee.style.left=marqueewidth+8, G( G9 Y. ?2 ], W
cross_marquee.innerHTML=marqueecontent
8 ]9 Z) |2 f& D3 Z4 sactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
4 z8 }* G- P7 R/ f) g" C0 C}
' S* y& c' R* S+ p$ B6 S* A% ~" _) zelse if (document.layers){
5 `* m4 q& a, ]6 Ens_marquee=document.ns_marquee.document.ns_marquee26 f" [( i, \* ]$ ]
ns_marquee.left=marqueewidth+8
& D+ q# ]9 j* h- r5 q% Bns_marquee.document.write(marqueecontent)
9 a/ j- e# Y, J- tns_marquee.document.close()
. F2 G5 [8 c4 w) c* F8 ^actualwidth=ns_marquee.document.width. Q3 B8 H3 S: s. p0 L: _: w& ?: `
}
j+ X) \) E6 d% z# y; K+ B* Llefttime=setInterval("scrollmarquee()",20)3 P/ N$ C- S- X% T; w# i( n
}% w' s8 M( n0 b
window.onload=populate
8 @6 Q, ]$ t" M2 A6 G8 s" P( B/ M R* K1 S$ t
function scrollmarquee(){* R; ?8 g& X. M2 ~" I" H: \
if (iedom){
& i9 t& t' [) R" U& c/ Y$ J" @if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
4 k& `; @, O5 J. O0 Ocross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
* D! C0 g6 P# ?* A+ Lelse
! Y5 W/ K* W- l. t; Q a% xcross_marquee.style.left=marqueewidth+80 j9 e d0 x# Q5 B. T& M
: j: B- z4 L0 U+ W! V; U
}
( j, Q$ f3 w; velse if (document.layers){+ m! W& a9 g8 ]( p$ `9 n2 B
if (ns_marquee.left>(actualwidth*(-1)+8))* T7 @5 C. w- |; n
ns_marquee.left-=copyspeed3 k. v3 S- z# m2 ]) J( F/ K5 D
else
" a0 ]) A9 a# P6 Z. F" ~* {ns_marquee.left=marqueewidth+8+ t, U# m' }. l' u2 R
}
' c4 O6 T, Q# e5 H% r* E}
1 l0 \7 k+ a' i
/ v6 k* h$ Z1 v3 Aif (iedom||document.layers){. u2 B3 W9 X$ g) F' `+ o' l6 M: g
with (document){8 h$ d% m2 f( R: a
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
: G2 L; p" a8 Q$ pif (iedom){1 n2 N2 X* {/ J( f" ^1 _- Y+ \3 `
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')- W4 K& q$ \0 \$ k. ~; }6 \! i$ w5 V
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
& Q2 ?2 H' ~" m+ Mwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
0 f& p8 R' J* Q+ f ]1 m: T$ i) t7 Ewrite('</div>')
0 u3 R) U; p0 k5 g* L+ i+ m}1 _; S' @2 z9 v; w1 b `7 J& E5 i
else if (document.layers){
6 L& V$ C' s4 V) |3 k1 Qwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
0 d6 X" ^6 r5 D d5 p! H4 Swrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')3 B& C7 Q% U) f2 B
write('</ilayer>'); q- T5 o* f# W0 y) C0 {! N ?( n
}
! L# M' U+ `9 E) Edocument.write('</td></table>')
" j# j; o" g& Y* P+ f$ G}6 E% A% g/ A( h
}
+ n# e+ a; c* }! o) n</script> |
|