返回列表 发帖

网页之跑马灯文字特效

//修改宽度
. ~* n9 x* D. }, K, t/ o! ]+ svar marqueewidth=3005 f$ H) ^6 K# m9 r' Q1 E
//高度
0 a/ s5 }& v0 k/ Yvar marqueeheight=25
2 c7 F* u; r7 m//速度(1-10)3 W' g  u& T4 N: E; |9 j* I* U
var marqueespeed=3& C# O/ J; f7 A  z
//背景颜色
  r7 N7 G" s8 Yvar marqueebgcolor="#FFFFFF"
7 y$ G" p! w9 J+ J//是否能暂停 (0=no. 1=yes)?4 l; {( f* w# x) T0 `/ ^
var pauseit=1
+ T! ~6 ^- X4 m% _; y! H) z: I- _; B. Z2 t# k
//修改显示内容
9 p. F4 C9 M' A5 n7 [7 `var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'  W' ^+ R# e6 r; C5 o1 ]

1 W. |: D2 d0 N/ ?( O9 N4 _; X: S! Y: z, @8 M
////下面不需改变////////////
0 B4 ^, a- ~3 d( v! C9 Y! d7 p$ W# U( {6 r; V3 {9 ^
var copyspeed=marqueespeed
. P( h% J2 M3 R# a: O2 E) c: K$ ovar pausespeed=(pauseit==0)? copyspeed: 0: N. r$ q& C; l) T* N% e; Z( ~
var iedom=document.all||document.getElementById" H0 C9 t" ]! i, g0 _0 P
if (iedom)1 y7 G0 ~! o$ J+ M
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
! C" M2 O9 f- W) a7 ?2 W( |, I% ^* I5 Qvar actualwidth=''/ W7 `0 f( P# ], U# x
var cross_marquee, ns_marquee
5 l. _: D- x+ l  k' |* c# y/ H/ A/ ?+ R' ~: n& c
function populate(){
- a5 [' f) r8 L( a1 @+ lif (iedom){. H3 j4 y, K% }; z0 V
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee/ x1 T8 P; }4 \& E. V
cross_marquee.style.left=marqueewidth+8
: u! j% w# w- F7 ccross_marquee.innerHTML=marqueecontent0 W- }6 X/ z/ a& _0 b4 d" z9 D
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth3 `% s) g- K3 t% b% B- k3 R5 ~) F
}
4 ]$ O* _% N# O7 J6 K2 n5 Delse if (document.layers){" I, U2 o; x1 y- e; g
ns_marquee=document.ns_marquee.document.ns_marquee2
( o( R* }. q  P  `0 p& @, C, S2 cns_marquee.left=marqueewidth+8( ]3 E/ Y2 p- f; L  c" A
ns_marquee.document.write(marqueecontent)
7 Y9 R% r3 p3 I9 Tns_marquee.document.close()
, \( h& m  B) P% zactualwidth=ns_marquee.document.width
2 W; d; H, ^* `* E3 L6 n6 D6 L2 `}# M2 X( ?& c/ ^3 |3 ~4 Z/ b8 j- B
lefttime=setInterval("scrollmarquee()",20)1 P2 q8 C- ~! _* x
}
2 d7 S. B) U, v7 W2 Q/ \' Iwindow.onload=populate
0 I: n8 j- U. e( P% L8 j; z3 ^% Q( \: p3 g* R0 N7 M
function scrollmarquee(){
2 T& o: d4 W0 d0 tif (iedom){) \/ e$ t$ Y7 k: Y( s
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))6 I% Y7 A2 n6 K/ z( `5 t
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed: Q" r# Q) a! b4 [& u1 D( k
else+ ]8 |/ T! A, P( F
cross_marquee.style.left=marqueewidth+8$ B$ _$ k6 @( Z; a
( m* t# @: W2 B( }$ w
}
1 O  k2 p. v0 j( j/ ?" `else if (document.layers){
4 H+ b$ c% d/ V! x8 wif (ns_marquee.left>(actualwidth*(-1)+8))
* {4 W1 B/ B% s9 Y& V( v2 gns_marquee.left-=copyspeed6 O' ^( f* @1 x
else- ^3 o& _3 {* P, x7 {- v$ z8 {& u
ns_marquee.left=marqueewidth+8
& o* u0 s- P7 B; m7 h" J: w}9 p" B7 l& M# F) s7 r6 i
}- Z6 X: @9 r" u. X4 p- _' d( m
6 F0 f; t/ R# U
if (iedom||document.layers){
- I% A" K  d/ g+ Nwith (document){5 f3 Z; }! g( t. F: P5 S
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')/ b5 i5 I6 C6 E- S9 a4 E
if (iedom){
2 g# P0 b" y6 Q9 j% Nwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')  O: b% Q5 \, r) ^
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
5 I( f8 X7 X7 ~( M: v" y  a8 v& Xwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
9 x) c8 l. o4 zwrite('</div>')
- I5 V5 ~8 {* C}+ ~  A9 N8 x& @+ l( S1 d: b, z! A
else if (document.layers){
: Y7 f& H& m( ?$ S) K/ ~: Fwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'): y+ _. e, ~% g5 E$ o' ^0 h0 l
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
8 L3 c5 P, Z. B, Z) o- l* ~9 Lwrite('</ilayer>')
% p* E$ [7 M/ r) o}7 }- e% P* s' x( ]
document.write('</td></table>')
8 I2 @# O+ u$ ^$ D: z) l}5 o: F$ S- [5 v
}: q  k# w2 T! p; l$ B
</script>

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