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

|
网页之跑马灯文字特效
//修改宽度# }1 S, Q/ l: P# b2 u+ E' N' l
var marqueewidth=300* O1 X2 m$ {7 u
//高度' q! c& U2 u- Y7 p1 a$ z
var marqueeheight=25( I* f/ l0 A/ g6 t% v$ A
//速度(1-10)- G6 Z9 q% T( ~3 V# l
var marqueespeed=30 o# A6 H$ T# X y; T
//背景颜色; p! h& v- b0 ~& g. v
var marqueebgcolor="#FFFFFF"8 r5 M( D5 N c5 }& m
//是否能暂停 (0=no. 1=yes)?3 ~8 G/ Q/ F5 V& E( T
var pauseit=1: U* |; c" o7 b1 }
* d6 z% N; P, \5 Y* k& w
//修改显示内容
/ L& k" u) K3 p8 Mvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
0 a( S( E; S0 |# t% X( V+ R$ ^( h$ W% r8 D% ]
2 ]" [: r2 T. Q6 B" B! R# P////下面不需改变////////////- w" M/ ~( U- r' r7 l8 s- Q/ Y6 Q
0 j4 a$ H4 U# \; V( O* y" \# G) A( Cvar copyspeed=marqueespeed+ z7 \+ @3 j, S% Q
var pausespeed=(pauseit==0)? copyspeed: 07 m) e' O* g1 u/ E: x: G* q! ~
var iedom=document.all||document.getElementById" k4 i" T' N) i
if (iedom)9 a- M0 x& y1 _, n9 k/ j5 j) B
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')' _& I) ?+ o1 F
var actualwidth=''
$ x' L+ w ]6 q! q1 [) u; ^& t1 U. c' ovar cross_marquee, ns_marquee% ~8 _0 v2 g7 m
% [, H9 O" j- d
function populate(){
6 M/ J7 w. \, S/ [3 N5 Hif (iedom){5 V9 V# t" s9 N' O' \+ Q
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
% ]# k/ o X' N' S, ]1 q$ mcross_marquee.style.left=marqueewidth+8
. |* R. \% J+ t0 `+ T0 y6 ^5 ecross_marquee.innerHTML=marqueecontent
. \. z' k( Y, ?# {1 a2 D2 a( iactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth) A/ v V3 _: _- |& S
}
* e% M) E0 u: A5 w3 T! r/ }else if (document.layers){
3 e* B( G) O% `ns_marquee=document.ns_marquee.document.ns_marquee2
2 l+ {. |' U% A" A4 O5 I6 g; G7 @6 Ons_marquee.left=marqueewidth+8
, o' R1 l: m; w- Y; fns_marquee.document.write(marqueecontent)
6 s% W, n# `7 ^ns_marquee.document.close()
! o# c# w. Z5 n3 H' [1 d5 }8 m$ Dactualwidth=ns_marquee.document.width& f+ F- J# N( z k9 E
}
0 k' w5 S: J8 m, c& ulefttime=setInterval("scrollmarquee()",20)
' s* E2 `# |8 j$ o! v" p}. p2 a3 a e1 @& `# r
window.onload=populate5 d; j: T" \4 u
}& x, @, ]8 [0 Z2 rfunction scrollmarquee(){
8 ]& v2 \/ y4 ?if (iedom){
0 O" M% m$ M. ^& _1 C! Yif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))* d: O1 {+ d7 q% h% n
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
9 i; f* J5 {' {1 q5 W2 o B, J" N8 selse( x9 W! n- q# i/ X. v* L: l! e# `
cross_marquee.style.left=marqueewidth+8
0 d* }' m/ z# `5 x* `& \
5 H- u9 K" {1 H0 ]; D) d+ x}
f1 O* g' J6 zelse if (document.layers){
6 }" q, N( g* u$ d: M( hif (ns_marquee.left>(actualwidth*(-1)+8))
$ `: p9 @; L4 \+ \* u' E: X9 F% t6 ^ns_marquee.left-=copyspeed
! J+ p/ l- j; R, celse. L6 e2 S7 s: ^, e, j/ Z
ns_marquee.left=marqueewidth+85 a5 ^$ g& i+ v8 Q" w! A7 K
}7 ?; {: j, p0 [, N
}8 w+ ~$ ^$ d. X. ?" T1 G, c6 w
3 E5 k$ L6 ]" q1 x4 y' |if (iedom||document.layers){7 n+ i* e( b. }6 f+ d- ~. i
with (document){( ^4 J# }- M; s, ]8 b+ r( m4 Z; B
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')1 F x% }8 L: O1 n" M7 S
if (iedom){( `! r% P/ o W( y! H% q
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'): q4 w+ |( ~+ Q! Q
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')4 a- T" f9 N E! C
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
, |3 M9 d+ m8 U; o. k5 V( Uwrite('</div>')
0 Z! |5 E6 N2 J}- \' f0 ?" L- s9 q* s
else if (document.layers){+ X! o" K( p0 z$ P/ m
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
% I. v X* a+ D( lwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')7 A. b: r2 ~6 S+ {* b4 [/ X5 b
write('</ilayer>')9 s: U' \6 ]$ n7 S
}3 R/ V+ o7 R- K- J! s; k
document.write('</td></table>')& o2 P) e2 a) W8 B
}
, G. L6 u! t; T# z( ]}3 i4 Y* r1 H) P& K/ ?# U' B
</script> |
|