获得本站免费赞助空间请点这里
返回列表 发帖

网页之跑马灯文字特效

//修改宽度( l+ e0 k8 g3 @* U0 }- x. l5 e
var marqueewidth=300. e( H0 j1 A- B0 G3 r: V3 x
//高度
/ R2 z! o$ @+ C* Mvar marqueeheight=25
/ J3 _$ ~" T# s7 p" F//速度(1-10)5 J9 X; `2 n& R) {8 N" j# o
var marqueespeed=3+ w. D: Z# |. L, ?' U
//背景颜色
- W6 G2 M& {/ s. i9 {var marqueebgcolor="#FFFFFF"
2 r) i" \+ V# A2 X* \. y  Q//是否能暂停 (0=no. 1=yes)?, n  F' F1 n( W( n! X2 }  i* f
var pauseit=1
3 W( r. k7 m* `5 }) U, i& R3 X* n! D/ l8 k% Q! W  P
//修改显示内容
7 l. J) @& F% s: {/ S/ s2 y' mvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
% a  f( H, S6 N& p9 f
7 a  g( v% d$ \1 v$ l3 w2 N2 }  S5 y& _5 k' j% M
////下面不需改变////////////% |- [1 a" s) O  o  Y0 m/ Z

. |: j3 m6 A" a" Y8 p" Tvar copyspeed=marqueespeed  _" G. U) e/ i; ], s+ T- m- k3 t- k# ~
var pausespeed=(pauseit==0)? copyspeed: 0
+ j6 H" u8 L4 m8 N3 }. `var iedom=document.all||document.getElementById
8 c1 }9 E3 @( N4 P% Dif (iedom)
4 J: d2 ~- N+ A8 M* Udocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')' }4 M5 u  P' u; p
var actualwidth=''
  h) ?+ r- u" v* v8 q4 mvar cross_marquee, ns_marquee
) d5 {( `) L! R- E0 O1 |) P! o$ |/ N+ t( f7 v. W5 ]$ C3 P, d
function populate(){
; F2 o2 a+ `/ `8 {7 D# mif (iedom){
* m2 L! s, S* T  }9 A1 Fcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee9 J+ P& @( }) d- M! ^- o: Q
cross_marquee.style.left=marqueewidth+8
; L! c7 P; @: m+ Icross_marquee.innerHTML=marqueecontent8 H, |! r) a) Z4 q
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth4 s1 `0 E  N! U2 V# E: w7 c, O
}
+ j9 m0 Y1 u) Pelse if (document.layers){6 L; C% T4 _2 N6 S
ns_marquee=document.ns_marquee.document.ns_marquee2! J2 h' e1 R# ?% @6 a
ns_marquee.left=marqueewidth+8
9 L0 ^: n7 W. Z& Tns_marquee.document.write(marqueecontent)
/ v# H: Y3 b2 ]3 f3 q; Tns_marquee.document.close()
" o8 n# g0 E5 c3 n5 q* `actualwidth=ns_marquee.document.width
% B& x. F( P$ `# I* w}
8 Q* \" t2 n4 F5 Tlefttime=setInterval("scrollmarquee()",20)# `# ]* u" Z0 E
}! C) D, v7 a' t# p
window.onload=populate8 ?/ @3 B! U- v/ ~' Y4 `6 @, Q
% p. m% l8 {& s* f. R* Y! {
function scrollmarquee(){, r5 V( p( b) v# a6 \# ~
if (iedom){
" k6 _7 H# N4 u( [0 P! z4 T8 H! B3 Pif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
) E( e. g) {& @5 k; \: ~8 I' Bcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
2 B. K1 W7 `0 h( f# @. b) Belse
6 K8 {4 p6 \" c0 K/ mcross_marquee.style.left=marqueewidth+8& b& O8 M6 ~: t$ q8 J
9 E; w( r' @. r$ P" _
}0 d  e1 @/ C1 S2 C
else if (document.layers){4 v$ m& y% z2 m+ e+ O
if (ns_marquee.left>(actualwidth*(-1)+8))9 O/ I0 R, C" t/ X5 r. U& d
ns_marquee.left-=copyspeed' [  o2 J# I4 \  [, A. T5 S) e
else0 t( n; b: \7 a9 Y9 W  y
ns_marquee.left=marqueewidth+8- B: ]% E% @: u" |: d
}
9 n2 K" [/ _+ |4 e# s& M4 q# q}2 P) h' M; c  a1 x" }
: L: r+ G2 B) t4 R1 F& @
if (iedom||document.layers){0 N. _( c3 g( X9 D: z7 D
with (document){
9 u% Q" p9 M% k  s% v* Idocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
- O) a) e( L+ d+ W6 k6 Wif (iedom){6 M! a* Q' a' _6 X  X' d
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
  L$ E& I8 P0 e9 l7 owrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
  V' `* k8 ^& L1 n7 j" Y1 rwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'), f: Q/ j) t- R
write('</div>')
7 M: G4 G# O+ k# f}
8 u3 E7 G/ f, J; n( j/ _else if (document.layers){4 H* ]0 m0 [' \) o$ \/ U
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')* C% v5 [: c1 _- S7 c( d* w
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
+ W! F1 ?% L" Y9 ]& {write('</ilayer>')
2 S1 B0 @. H. I" k! @- W3 e* q}; @9 ]1 {( R$ V; l! z5 m
document.write('</td></table>')2 s7 _; A! s2 I. Y) A4 m6 O
}% U, t+ H$ m# _6 A  @; [
}/ C  F( _( P7 k5 v+ u9 C
</script>

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