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

|
网页之跑马灯文字特效
//修改宽度
! n( v4 A( q# e- R; w7 yvar marqueewidth=300
0 X& ^# @% c, Z8 J8 `9 M//高度
) |4 s) V+ H8 M ~6 V1 jvar marqueeheight=25( _5 a% }$ c/ B0 N6 u
//速度(1-10)
- Z% T& l% R6 y: D; }5 `) ~var marqueespeed=3- Q% e$ ]+ R3 E0 w' n, K
//背景颜色6 f" v3 R" c; r( N% F; r' B9 V$ F% B# i
var marqueebgcolor="#FFFFFF"7 G& Q: f) M/ l
//是否能暂停 (0=no. 1=yes)?
/ \$ _+ | o" K# g; k. Q, {var pauseit=1
8 }' L0 a0 J/ y( J& {# y( m$ F2 G0 P& ?9 ~' ?% H$ I+ t
//修改显示内容. F6 Z, c6 v# S) ?+ ^- W" ?2 R
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'! N8 P$ z; B, D% z1 ^4 E8 f
% A4 M0 F( D: o% K. l6 s+ E- F! n' q) J
////下面不需改变////////////
6 N9 K! i) Z. e! X5 {+ M1 O: R1 t) L; |5 e4 w
var copyspeed=marqueespeed" V, R+ E! G8 u9 P
var pausespeed=(pauseit==0)? copyspeed: 0
/ s6 F+ P: d, g; }/ ~var iedom=document.all||document.getElementById( S/ F J& n- k+ T0 n
if (iedom)7 V% Q2 ?) A7 o. M; D7 T! V0 Q/ l
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
, l6 ^7 J" ?: b1 y3 j& @var actualwidth=''% J5 q! Y7 X( y7 d, ^$ A: }1 J. {# F
var cross_marquee, ns_marquee. b/ w; B( O8 ?. F% l# F* j; K! @' y2 ~
; u, v& X) ]+ H: efunction populate(){
. X' e4 ?) z; x! b6 ? i$ P* Dif (iedom){4 N, _+ Z/ u \& @' c
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee6 l, I( `1 }* Q. l
cross_marquee.style.left=marqueewidth+88 P$ T- A8 b R* b& O% \
cross_marquee.innerHTML=marqueecontent& o3 T9 _- c5 ^9 V: Q
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
: T8 x$ z" A g0 i& t! r}
! u( j" s+ \3 o1 E* x5 Eelse if (document.layers){- {! k: t. w, X1 I5 L
ns_marquee=document.ns_marquee.document.ns_marquee25 a# e0 `$ b' l1 A
ns_marquee.left=marqueewidth+84 ~, X/ @) M# o+ `# t% C9 h! ~" i
ns_marquee.document.write(marqueecontent)3 N, E2 m6 }% C8 p. H+ C$ v+ X5 t
ns_marquee.document.close()
* e: Y6 n0 l4 b' `! X; hactualwidth=ns_marquee.document.width# \' @; m9 P. m) D4 Z, b
}: T4 z$ Z _! S. ]& W! J( Q
lefttime=setInterval("scrollmarquee()",20)' ?7 B* y% Z. Q5 B/ v# S
}6 m7 @, t" H! K, h, X( i' k
window.onload=populate
, N! b/ W5 x) B$ {# h$ z, w) w% J) Y% }) ^* D% J( r" o
function scrollmarquee(){0 O4 T3 S8 a. M
if (iedom){" J& S4 R3 P4 I5 S; _
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))' F0 P, r$ S; I W, m% L) i0 \$ F
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
6 }% V7 o* }" D- ]$ A/ Ielse. L* D2 f& }; V9 W- o- b# C
cross_marquee.style.left=marqueewidth+8- r b4 N3 `( I9 \% R
2 H& i9 l4 ~2 J& }! d+ L+ G% F}
" q" c! H$ `) _* }else if (document.layers){
# Q* b$ m) Z, P4 Yif (ns_marquee.left>(actualwidth*(-1)+8))0 C1 L \$ `/ K8 b
ns_marquee.left-=copyspeed
( k& F' K, q3 Welse
0 a3 T8 q5 a' @9 T) e7 t, `ns_marquee.left=marqueewidth+8+ M6 F; s+ z" P& L6 _) X
}/ y& d% G' S- @
}
+ h4 }+ g% p. p. ^, T. A, z0 g" v* f' G9 F
if (iedom||document.layers){; e3 k1 t5 Y1 b& {8 T
with (document){
; ^' k x. ]0 f( Q6 u8 Edocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')# Y5 u4 I2 c' ]$ h+ Q7 a
if (iedom){. R1 l* p! J2 |' F* h; v: O
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'); H8 o$ K% A1 r5 X( E& P
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
9 I7 ]6 i: l9 Jwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'); z( `" v! {/ \! J+ ?
write('</div>')6 e% v7 L7 i% k8 E
}* C+ Q+ c8 S' k4 \
else if (document.layers){
3 G( D7 H' E" Mwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
% M1 q" _9 e% J; swrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')7 Z/ M8 |/ R8 r" C- G
write('</ilayer>')
! g% f5 m( \) j# O& P% R3 n8 u}
: p; q7 b" @" i4 Udocument.write('</td></table>')0 K# ^+ E( @. ]3 d/ [
}
* ~) }( T: ] F}
5 J* K- p" Y7 @7 w6 H5 L</script> |
|