返回列表 发帖

网页之跑马灯文字特效

//修改宽度
; v, ~+ i# o" \$ ^% P6 U/ r8 `var marqueewidth=300% ~  _! e) I. [' L
//高度
$ b0 n  K9 c9 K, q, fvar marqueeheight=25
% `; c3 d  k- |//速度(1-10)( m4 T8 c5 \8 w1 x' j% K
var marqueespeed=3
+ G4 f7 B2 }# P1 x0 {  N//背景颜色
+ Z& ?  j; X; [. l3 r. ovar marqueebgcolor="#FFFFFF": z% G, p  ?5 `- c6 J% I
//是否能暂停 (0=no. 1=yes)?7 d. ]+ S6 ~; k( q! }' D
var pauseit=1
. r; g2 e/ |+ K! s4 O. p; L8 H$ C2 f2 k
5 G7 d! z  i# V3 p) N4 ^: B2 |8 }4 f//修改显示内容
* s# B; u: E2 ~; Mvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
( M" P3 K1 [1 p3 p) Y1 S* o+ h3 O2 n% F' p+ l- K
# J6 T" w5 k  }6 G
////下面不需改变////////////7 B7 w/ \5 W, u1 K' o& @7 q
% v- z6 _3 A- x0 t1 b
var copyspeed=marqueespeed
& P+ t8 N; ?, b3 ^var pausespeed=(pauseit==0)? copyspeed: 0! F: E2 _8 n6 u1 j' [: L
var iedom=document.all||document.getElementById" b; q2 d/ A$ o* v2 U3 `
if (iedom)
2 K- J$ A0 ~- n# _8 ^+ ~% jdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'); O2 Y- |& o: a2 t
var actualwidth=''
! o' x3 |  B. Y6 S. S; svar cross_marquee, ns_marquee* K  ^% ?6 c: A% ~+ U
! K  h+ r3 g, z  D6 V1 \( f
function populate(){9 `7 m% V9 V' p* d. Z+ T
if (iedom){4 X% o9 X1 D) u
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee2 P$ P2 w& Q1 E2 k/ X
cross_marquee.style.left=marqueewidth+84 E! T  ~/ \9 x5 k! ^5 M
cross_marquee.innerHTML=marqueecontent
0 K& g0 a& m: A  s! k/ M* q; `actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth3 t9 @! V1 u7 Z
}% }) s' G6 K' W4 g8 S7 t1 H1 Y( H
else if (document.layers){
/ n+ g( V& y" ?; e5 s- L" W6 X" k! [ns_marquee=document.ns_marquee.document.ns_marquee2, Q* I! V$ q; G1 G- }; x. B
ns_marquee.left=marqueewidth+8; Y1 y" q# W/ Z0 X4 O
ns_marquee.document.write(marqueecontent)
' O" j+ z% H0 }) z& M4 _ns_marquee.document.close()6 C; E# K. U# A7 L  e- I
actualwidth=ns_marquee.document.width- I0 k7 {8 c2 b7 Z9 t2 S2 q' ]
}
" W* }+ p* N. ?9 o- jlefttime=setInterval("scrollmarquee()",20)) Z& o5 _7 l; a" u
}7 i. ]- T/ i2 |, x1 ]& d
window.onload=populate3 k: S6 a0 \' n- E3 y+ _

; N9 G$ y; r! t7 Ifunction scrollmarquee(){
: C* ~& j, J* m/ D; Q0 Xif (iedom){2 S) ^- W0 j8 d" w( O
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
; D6 O0 S. E% P  U+ N8 h/ hcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed/ |; U, I* R& L& s- d. K' m
else
  p3 f/ C4 f* k' b& Vcross_marquee.style.left=marqueewidth+89 j% ~5 G, h0 ~! n6 Z3 ?

  U0 z+ t  k: [4 `}
$ u0 m3 J, X9 p2 {else if (document.layers){, ^* ^( ^# i  Q  ^$ j: r+ N2 I
if (ns_marquee.left>(actualwidth*(-1)+8))
. J: q' {0 {! g$ W" l3 C* g2 tns_marquee.left-=copyspeed
/ F" v  ^" G: U$ ]# Yelse/ d6 j( M, c1 j' E" ~! p
ns_marquee.left=marqueewidth+83 c$ Q* x* U3 g2 l" y( r: A
}
; w3 X5 t$ e( Y}
. m# I) n+ `$ V# m$ R2 ^4 Q% A$ H" _: L+ i2 \8 u
if (iedom||document.layers){9 o" L- s$ b; {9 k0 z' B
with (document){
- ~) p0 b6 X% s0 Y" q! A8 qdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
& t' L- w' h5 Z/ S9 M! _3 rif (iedom){
0 R5 l! I' _% j$ owrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
/ O) h: o5 V% Z" G1 ^write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
  G- j3 t0 u& Z3 }# D3 Zwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')! B% a0 y/ e- y# F+ t- A; ]
write('</div>')
& P" j; A, k) r4 @% V}
) Y6 [4 B0 B  j: ?. A+ Aelse if (document.layers){
2 e4 s! F& o; L( r6 Ewrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
# N4 {3 j0 m! M8 H1 gwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')$ O- g; G' i1 L7 B% M0 h; l
write('</ilayer>')
% K* y6 U" [: z" X1 V& O}9 {0 m! {* u- B) Z& w
document.write('</td></table>')
+ H5 s8 ~" I1 g- F/ H" \}
# X( b: c6 c6 h! E" z* M$ T& `$ M}' W# _6 M4 k8 V/ n( v
</script>

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