返回列表 发帖

网页之跑马灯文字特效

//修改宽度
, ?& R: D) _! ]8 n; M7 \. O* fvar marqueewidth=3001 {" ?( K9 @- h5 J3 D; c
//高度8 C: U( I9 K5 ~
var marqueeheight=25
: X$ S: N' s3 f$ m2 m3 s7 s//速度(1-10)
" m  r5 w) K; ]( e! h1 }+ pvar marqueespeed=3: ^6 J- n/ e  x% G0 G. l2 i
//背景颜色* E$ l( B: D, V( B. r! l
var marqueebgcolor="#FFFFFF"
" Q8 t( N* H# C( t1 r//是否能暂停 (0=no. 1=yes)?
) A2 n/ x, O' l' Fvar pauseit=1
0 H7 x% C  W( M& Q2 W; F; T' ~. e$ a- z* @6 M) `
//修改显示内容/ Y& I  J! i# A( ]3 x, C2 J5 |
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'7 v) i; N4 _' `$ F
- ~6 Z- ?: i* o" p1 ]9 ^

4 N+ u' V6 j8 G) s; e9 E# I////下面不需改变////////////$ ~8 p0 E7 R# N. \( {; y
! C4 {, a! K6 h& l& [: C* F: w+ I
var copyspeed=marqueespeed/ {1 E) c6 }( R4 R
var pausespeed=(pauseit==0)? copyspeed: 0" N1 p& Y- t0 U  a
var iedom=document.all||document.getElementById! Q+ f/ e  ^: V: }4 z# E  R5 B/ ~
if (iedom)
, T# g; g9 ~. h8 O5 Ddocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
4 t$ y' X: \" S8 z* i* Rvar actualwidth=''5 P1 g7 F5 y# l" J- U" z( x
var cross_marquee, ns_marquee
3 G/ q! h: e5 ]. C+ z( P
  f1 o" S8 a& l3 u8 f8 zfunction populate(){
; O# o) Y) S& v: w4 ], @if (iedom){
8 a" H& p, ?$ K& O9 \; ?+ L/ Vcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee6 x! @7 I8 @/ R: p
cross_marquee.style.left=marqueewidth+8
- Q$ w* d( X8 ?cross_marquee.innerHTML=marqueecontent/ g/ `4 H$ f) F: T( q2 G) U% _
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth; o5 K- ^$ l2 b
}" g0 `; Q) V- I! R6 ~& t
else if (document.layers){# ~% \1 O$ r- x/ `8 q  e+ `" B
ns_marquee=document.ns_marquee.document.ns_marquee2" P5 w+ `. d- f3 p6 q- @  K1 W" G
ns_marquee.left=marqueewidth+8
! O3 V9 t1 C& E- T( y# yns_marquee.document.write(marqueecontent); _, I/ n5 k& k3 S
ns_marquee.document.close()" I* R! ~  L  j( W4 c
actualwidth=ns_marquee.document.width& i) b  R2 R- }
}( d! z! v8 y* _( o( G
lefttime=setInterval("scrollmarquee()",20)
7 Q: ^' y7 Q, \( P, N}
6 R6 _0 i5 [% awindow.onload=populate
# w4 `, R( w! \8 y" g* M
' X! G3 q% I9 X5 ^3 Lfunction scrollmarquee(){
) V, y/ o- \" h6 Z/ ]if (iedom){
0 n" u% T/ A6 C* Q% P& S% Nif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
' v" l+ Y' ~9 ~2 zcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
- B$ w( A. \7 e9 f7 x" U: Pelse
, G. l0 E8 _2 `9 Q& e' f2 Z# hcross_marquee.style.left=marqueewidth+8
* B& Q3 I& F3 h; X$ L; W" V" x& [; U2 O) G2 i) Q/ O$ y
}
/ ]/ \* B' ]/ N0 Uelse if (document.layers){6 S6 v: v0 h$ M/ @- N( e' a
if (ns_marquee.left>(actualwidth*(-1)+8))
6 Q% I/ [  c( q* A  kns_marquee.left-=copyspeed8 n7 q" i* `7 a" B/ _
else
* B5 L. f5 H, \1 c! L, kns_marquee.left=marqueewidth+8' M0 T$ F+ Q8 Z+ I5 i; Q  E
}
2 O  g* ]1 O- N% |# O}6 p# z& ~7 R2 x9 R/ u

; v( q! E" X/ V% Bif (iedom||document.layers){8 C" D( |3 r& a! Z5 a
with (document){& x& @/ r8 P" R' G; d
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
+ y; R4 w) ?- G; T$ y7 R/ L8 Iif (iedom){* F$ h+ B* }% U# [: Z
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
  o, l) |; r- B! ~' E. d+ rwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')) t4 L8 y" ]; Q7 M( g
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')& H& h  R# ~% k8 D2 X" ]& k$ r& o1 ?
write('</div>')
$ X/ G8 i1 X& }}# O2 c6 c3 [6 x* ~& g
else if (document.layers){8 ^! K2 G: G: x* A
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')  V& Y' v  K/ O8 l, X) ?
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')% E2 \& H) u* |1 E
write('</ilayer>')
+ s3 F+ X* h" c- s3 ?}
1 n+ K" Q1 S! rdocument.write('</td></table>')
2 d, M0 b6 e: [# C, u}/ @% h# F: z% H
}4 M' i- u6 }5 o- d4 R2 ?
</script>

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