返回列表 发帖

网页之跑马灯文字特效

//修改宽度) X+ i1 A1 i& M9 `4 r
var marqueewidth=300
: s0 x( L8 w# Z% m//高度, w: ^  E2 F) x
var marqueeheight=250 M' ~, p5 [+ m& H  W9 Q
//速度(1-10)3 F1 C3 I8 w6 p  I8 ?
var marqueespeed=3
# v) K: a' }* z& e! L1 T& ?//背景颜色2 x% ~! M4 D% D9 \2 N
var marqueebgcolor="#FFFFFF"7 |* e7 a, S) e9 }
//是否能暂停 (0=no. 1=yes)?) G3 |( d- t# T$ M3 q
var pauseit=1# a- m, J, M3 S  B5 B/ |
' q  p; \& k& ^3 A% W
//修改显示内容6 S( `* J6 l$ K/ G$ A9 \# A- F# E
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
, f# e6 U$ k/ H9 }6 b# M2 K% P8 }/ c  N: g2 Y0 }9 G) N2 N& g9 o

- I: T4 J! i1 N9 p0 r- ~////下面不需改变////////////1 Z# r) F) Y3 c: O* X

5 \7 u7 R1 c- T! c5 ^8 qvar copyspeed=marqueespeed
5 U; {0 A" c# T% Z4 c6 }" X6 Cvar pausespeed=(pauseit==0)? copyspeed: 0
# t% `7 h4 k5 w1 \3 I, d( E# G" G9 kvar iedom=document.all||document.getElementById
* M, r" p  B5 w  ^if (iedom)5 l% r+ @2 n8 t0 C" a1 Y! I7 t0 S$ E
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')( }8 S0 l) R2 \# C
var actualwidth=''
2 Y8 x5 x  E) [var cross_marquee, ns_marquee
2 ~: h8 _& m- d$ `5 {5 {4 S+ X% U( J( U
function populate(){4 M8 i9 X! `% r
if (iedom){
6 J, P% r9 Z; V$ v) L9 s3 _, [cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
! c8 f, u  [7 ]1 `& g$ {7 ?, M1 ]cross_marquee.style.left=marqueewidth+8  ^( l5 Z) b2 s- p. T) [5 Q
cross_marquee.innerHTML=marqueecontent
3 H& _& V, M4 F. O: p* pactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
& q2 d% [' j- q8 N' U$ |}
+ z; M; U( x  X  c9 aelse if (document.layers){
8 F. x' p1 J# ~4 |& v) ons_marquee=document.ns_marquee.document.ns_marquee2
0 u% L6 A" a" t( ons_marquee.left=marqueewidth+8# ?4 k! x. d! N% |9 L" H# h' T4 _
ns_marquee.document.write(marqueecontent)' y/ s: }/ j! K5 f  T6 C  w  J3 n
ns_marquee.document.close()
6 k: l8 y* F' R5 Zactualwidth=ns_marquee.document.width
( n+ K& {3 R! P}, |: r, b1 V! I5 X* p
lefttime=setInterval("scrollmarquee()",20)5 x7 [7 I' D- x
}
$ B. M5 Z# B0 o- Kwindow.onload=populate, ^8 _0 T3 s( E7 H8 }
$ {, t; g/ k9 g/ h
function scrollmarquee(){3 z( Q% E7 ]: f3 C) X5 V
if (iedom){: t  i5 Y8 ?+ a( m+ x! T
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))5 o: O, q! A$ T
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
: w5 o# Z2 h1 ^1 R4 n% K- Pelse4 ^; W$ P: v# M4 x+ z3 O9 Q
cross_marquee.style.left=marqueewidth+8
+ c$ F: x8 d; H! h- j' O
0 p, |+ A  c# M0 T}/ }, A1 g! B) P0 r* r7 m. A
else if (document.layers){
5 _; V8 u) V# G, \5 Y  K, G4 Tif (ns_marquee.left>(actualwidth*(-1)+8))2 X& g: T" Y; p: @; B+ {
ns_marquee.left-=copyspeed/ G' p; q- T2 o0 L! P, l" p
else
% x  ?, @, k2 g& Pns_marquee.left=marqueewidth+8, S; Q+ x  n4 A- D" y/ `' O
}7 K5 f; E0 Z! w% K! A
}  w+ s  {- Z: E* ?

; s$ h% `7 A! V' V' q# Oif (iedom||document.layers){
4 Z! @8 b% Y0 ?/ z" \0 q' `with (document){
" p- E; j0 O# a# sdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')+ Q; t- f& ~' |' T6 ^+ e" R
if (iedom){6 M6 D8 M& Z& r" c( u7 i# o1 W
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
/ z2 A/ E% f2 Y, S) `write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
$ U/ Q  ]1 u7 Fwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
+ h8 ?! }* x& k  ~% N( i) Bwrite('</div>')
$ S5 B" \. W4 C! }5 T}
& p, \( W5 |# B; ^6 h. ]4 R: A0 p" qelse if (document.layers){7 F3 O! X# E; F5 q; _
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
9 o4 ^- S' ]! Z" ]1 @- Swrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
1 v& C; n5 S) B( Qwrite('</ilayer>'); y8 p" m: b. n1 {" d0 l
}  H7 L. P# C' K; @
document.write('</td></table>')
2 X6 y# v! c+ {% t1 U}
. L+ K3 g9 i7 u: Y. D}- N& \# W- p/ h6 E
</script>

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