返回列表 发帖

网页之跑马灯文字特效

//修改宽度
5 K$ i0 P+ R5 Uvar marqueewidth=300$ ?, f  H' M  b: V4 U3 f# f* q
//高度; y: q5 |) Q! W. h
var marqueeheight=25  _( X+ D6 |. k1 P" J
//速度(1-10)
" a8 v2 i' F% i( v* zvar marqueespeed=35 _; y4 F6 l" r- F+ \5 [
//背景颜色4 T7 d) M& X$ f- C9 [
var marqueebgcolor="#FFFFFF"
3 ^8 d- o3 s  o- X# p//是否能暂停 (0=no. 1=yes)?
: M, ^4 I! a1 @; ~9 c# D" v) j" avar pauseit=1. T3 v9 J& J' Y1 w# O9 r. H
2 q% Z& _0 d6 I: B
//修改显示内容$ e$ y* n$ T* |" N
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
0 H" t0 a& ^0 |  N6 g  z$ D; M7 j* B0 ^! w3 e! m" |" v
6 A) p* M2 \$ ]
////下面不需改变////////////
2 p) I) v0 C) j2 Z7 A$ z- l% D2 O
var copyspeed=marqueespeed7 E9 \/ n. P, u
var pausespeed=(pauseit==0)? copyspeed: 0
& ?0 g* H+ f+ M! gvar iedom=document.all||document.getElementById
: b; H, A: P5 z4 z9 N8 Oif (iedom), U9 N3 c# p2 C' H+ G. E# @! W/ l
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
0 O) j: D3 k: v2 N( Jvar actualwidth=''
7 g3 Y: X( _; s2 F. qvar cross_marquee, ns_marquee
3 h  x$ i( ?6 n: o- C8 j- @# ?
0 X" `9 y7 d' [2 B" [function populate(){# F# a  U8 t; \1 V$ v2 I2 ?/ r; X% r
if (iedom){/ m6 _6 ?6 _  X& T" {
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
5 E1 i, {' |% Y# tcross_marquee.style.left=marqueewidth+8
. ]" v* j+ A/ \6 o- Vcross_marquee.innerHTML=marqueecontent/ x0 c: b9 A! r8 Z6 L( @3 D
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
) u; d0 p/ e; Z$ b}
% Z6 C6 \( g; _8 f# y8 X3 Relse if (document.layers){
8 a3 I  o* G. S, q% ]0 p. |$ ins_marquee=document.ns_marquee.document.ns_marquee2
6 d5 H8 m- t, |9 }; wns_marquee.left=marqueewidth+8
- x1 q; b) S6 M1 x+ M+ q- Dns_marquee.document.write(marqueecontent)2 t6 F& X' M/ _& Z/ D, b
ns_marquee.document.close()
8 ~2 h2 s5 k6 e5 l9 B5 Kactualwidth=ns_marquee.document.width0 [9 u4 D8 P( A- \5 \
}" \( }2 j* B& K5 Z9 f. }5 p
lefttime=setInterval("scrollmarquee()",20)+ T# g+ `1 e; L! n
}8 w& R- ^/ Z- {4 n
window.onload=populate9 O  R0 p/ a7 T
& N: V- y0 q& s- N8 `+ f6 y
function scrollmarquee(){& g5 \4 o4 g: Z4 G* r1 n0 H
if (iedom){
4 i9 M8 O. I+ ^% \7 c9 r+ Wif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
4 _" e+ n9 o* I1 P! f4 d$ W: x1 F* {cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
6 @- D' s' s) H, U/ L6 D( Jelse
) h: j# r" T, S! |0 Lcross_marquee.style.left=marqueewidth+8
% h& V  j; r1 j  g# S* C$ J( X+ e$ `# p2 w( ]4 p. f2 @
}- i; ~( c8 r' ?
else if (document.layers){
9 W4 |' L( o; ]  Iif (ns_marquee.left>(actualwidth*(-1)+8))
+ }/ s6 f8 L. x7 N6 lns_marquee.left-=copyspeed3 f2 h4 q2 N9 P0 b& z
else% R( m4 V8 H+ x+ o: y9 g( N* c
ns_marquee.left=marqueewidth+8! a- L! e  n( W2 ]! q% t
}: ^% j% E& V: ?- X5 i( ]) c+ D8 z
}
. K0 {0 d7 M! A1 I0 i, Z% [2 v
* w' ^1 K* P4 l( O7 s# nif (iedom||document.layers){2 s2 S3 S( R; N- x
with (document){
4 t: {+ `8 A2 U- d1 c9 a) Pdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'); ^* y6 g& X% ]
if (iedom){/ |' L4 Y0 H3 I' a' z
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')# q* }, |/ q7 e
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')- r) H0 e+ T+ m: a# Z: f, \; i
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
( ?+ B8 {- m" C) Z1 Y1 jwrite('</div>')" S5 q4 h& \. Q
}9 s* ~$ _# V  m: m( \! Y$ Y
else if (document.layers){4 }" T4 e, ]/ L5 c6 i  S2 |
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')) r1 h7 X- b+ s; Q" \; v: C! M( c1 ?
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
" n0 A4 y6 x4 x+ H% q7 S5 owrite('</ilayer>'), }* E9 r2 B+ C% \& h4 W
}. C! U! o4 O3 P
document.write('</td></table>')1 W/ x- O* W6 I  x% U. U+ z
}  H8 P+ m/ f5 u2 m% c4 Y1 A
}
& ]0 l) k4 k9 w4 p8 s* @% k- w</script>

返回列表
【捌玖网络】已经运行: