返回列表 发帖

网页之跑马灯文字特效

//修改宽度
+ o& m& p$ M2 o1 n/ g# ]0 Lvar marqueewidth=300
( c7 p  V9 P7 [2 a//高度
* i$ \( V9 p; O! }) Wvar marqueeheight=258 A9 E, y5 y( M) E
//速度(1-10)7 f; @6 D/ H6 }9 j; S
var marqueespeed=32 V+ b$ A: @7 w7 }0 t$ R9 p
//背景颜色7 [, S# y9 s$ Z5 `# U" z
var marqueebgcolor="#FFFFFF"
4 J! H8 F- e* O8 M//是否能暂停 (0=no. 1=yes)?0 r; \( }/ x$ p
var pauseit=1
# I7 B1 ^* L& e8 w) w. q( \# h5 ]) U
//修改显示内容8 S/ x3 d9 K$ k  D: ~5 X
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'0 u3 b8 I3 l+ x4 G

+ M8 n: k) w3 l" k! P; }0 H
$ \$ F6 c6 K+ E/ |- U////下面不需改变////////////
) D1 A: Z5 m5 b# C& y) G7 t5 k8 b* K) j
var copyspeed=marqueespeed# g/ K7 R1 @3 o; @# H6 k( I
var pausespeed=(pauseit==0)? copyspeed: 0
, I) }: I' k2 v0 u  B$ N) Pvar iedom=document.all||document.getElementById: z% B5 m7 m! R: ?( Y
if (iedom)9 u4 K. d3 S: D" j* P5 W
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')5 b* t0 s+ U4 r' j) F  X- N( A* n
var actualwidth=''
' v% {5 ^% D- T$ g" dvar cross_marquee, ns_marquee% }3 }  _* w2 i/ |7 H3 j( ]0 v- E5 t1 D

7 }1 @& @; B. N, @4 M  afunction populate(){
+ v7 |; R5 _: z+ q" |0 J/ d" W0 v% \if (iedom){/ T; b1 V2 ^$ N4 M6 {3 U) o" |
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
* l0 K# K+ E- ncross_marquee.style.left=marqueewidth+84 I3 @( L: c0 |$ j
cross_marquee.innerHTML=marqueecontent
1 ~: v$ C! k4 S& {0 Zactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth9 o* C( Z4 I+ D/ Q/ Q
}" N+ f3 |/ [8 q6 B; h& _4 U
else if (document.layers){( M& w( `% b* D5 p5 ]
ns_marquee=document.ns_marquee.document.ns_marquee20 V9 E4 W5 Y% t, q" P, P. p) p0 d: J
ns_marquee.left=marqueewidth+8
1 @6 p0 w0 d0 @2 N- ]7 L7 q6 n+ _ns_marquee.document.write(marqueecontent)
% m! d) Z: @: T8 j4 a: G, j3 rns_marquee.document.close()
( c% A+ i! N6 _% H2 d, D3 T& s! E: |actualwidth=ns_marquee.document.width: R( G& n0 S% {9 H1 l4 Y: l* F7 R5 M5 Q
}
/ `5 p: f) i" A/ Klefttime=setInterval("scrollmarquee()",20): w/ x  l. i. \! ~" [1 H
}
% v5 T! ]' b" ?0 Nwindow.onload=populate+ F4 r( a9 d6 d
& i; H  j7 |2 T2 x0 q5 q$ X
function scrollmarquee(){
, r% Q7 k( y2 a/ p( rif (iedom){
! l0 e4 ?1 X" _! S* G6 wif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))& n7 @; E- v* }" t( x5 \
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
) G" ?/ v$ \+ S+ W9 U( l5 delse/ [% {; k' p5 L1 s4 V6 k
cross_marquee.style.left=marqueewidth+84 I/ z4 \7 L/ S" x0 V- ]3 @* Y
$ K" D1 T7 m' f3 n& }4 Z
}$ Y: V, ?% V$ `
else if (document.layers){6 r9 R: c+ x* `' q
if (ns_marquee.left>(actualwidth*(-1)+8))
! c) ^3 }: f/ D3 Qns_marquee.left-=copyspeed( m; O7 b: [+ p! |- o# L
else
5 p! q; _4 R; M/ ]ns_marquee.left=marqueewidth+8
1 ?4 d+ F  n! R0 O, o, x) Y0 }% Y# u" b}
# W4 _' p+ ?; q}
( o. U! b6 A$ R/ L5 `( c/ [) M1 [1 v" N8 V0 G9 D4 _8 ?6 q
if (iedom||document.layers){
  f+ g1 k3 s) \: i) x* _- `with (document){
9 U' U8 ~% `6 Ldocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')0 k" `" f9 c( r% P4 R, {
if (iedom){
6 D+ u9 ?3 @% e  L% V/ }write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
/ b* O! g% K+ k! fwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
9 i# E8 T) {! Qwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')5 O5 Z0 `5 S' i* _/ g
write('</div>')
6 a, Q, e& @3 T; ^  o}, R5 N9 `, Z- F1 c$ Q
else if (document.layers){
/ e* o" ]; i, C, F9 i0 R) [2 nwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')3 o' e, `$ q( G, U; G
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')" B% J! E* g7 M. ^; R3 [
write('</ilayer>')+ U/ Q# j9 ^; e6 j# U" I
}: u; x' Z% P, P: ^  e
document.write('</td></table>')! ?- {! g2 `) O
}
) Z! L* m% q, R9 S0 S. s}
6 \8 k4 P  E8 X* b</script>

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