返回列表 发帖

网页之跑马灯文字特效

//修改宽度* M; {! a5 u: q; l- {2 J
var marqueewidth=300
( B5 \9 Z3 j& ^  o0 P8 J: o//高度
9 y  S5 e% e4 s8 W+ c1 p  {7 `var marqueeheight=25' V; z7 O% `0 @& J8 E9 D( A
//速度(1-10)
! z4 E$ l5 L! ^& M+ f% I' Svar marqueespeed=3
: x6 d" }& ]7 l4 D) T  N5 K//背景颜色" j5 e9 l- x9 [/ T" I" i
var marqueebgcolor="#FFFFFF"
" }; Z# i2 _0 j, d//是否能暂停 (0=no. 1=yes)?
9 m! Y  l2 a% ~var pauseit=13 S7 Y# g) j, o9 G+ D  I0 b

7 q5 M+ f: z  }6 q//修改显示内容
2 e+ s0 l8 }6 a5 r: T. d, L. Y% Cvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>') A1 W# V- `; O. s. D

/ z) u) z6 Y0 P1 x( r
- g2 b/ _9 D2 k0 \1 q////下面不需改变////////////
4 z( w4 \6 M1 l* G$ v; b3 w3 K; i0 P/ y0 i! j. u. k
var copyspeed=marqueespeed
; c% w  P9 k4 y# Xvar pausespeed=(pauseit==0)? copyspeed: 0. d' @) [  l" p: l4 Q0 P
var iedom=document.all||document.getElementById
/ p5 {9 x! M; u" \  r  N' @if (iedom)
2 A% K. e9 \+ Kdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')5 M" p- ]8 d$ |9 b/ }- \5 j8 k. u
var actualwidth=''' m& M9 Y3 G/ C
var cross_marquee, ns_marquee7 x2 K. o% H, z3 ?

8 ~& Z( b& B: d! `; C6 afunction populate(){
! R! J0 L# ^& k6 z3 J7 ?if (iedom){
: H% J* ]: X: B4 T) l/ rcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee* M) A3 R& {" m, \8 h3 j
cross_marquee.style.left=marqueewidth+8
, Y" h- ]. W( C4 }cross_marquee.innerHTML=marqueecontent' h! ^# a1 `% V& C; h; R
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
8 E0 l, E; z8 o" E2 t5 v% E" F7 Y}
# m; J0 K+ e" p( O/ Selse if (document.layers){$ M% G! a  N/ j- F" ]9 Q( V/ f
ns_marquee=document.ns_marquee.document.ns_marquee2
+ h& r( i( J( v! t. z: Nns_marquee.left=marqueewidth+8" O" Q- C+ |3 Q. l& M1 i$ ?6 r
ns_marquee.document.write(marqueecontent)
$ D; }0 |! c" s" n2 N" mns_marquee.document.close()
1 w- i- ~- r) B( wactualwidth=ns_marquee.document.width; _. v$ ^  {' y9 a/ ~
}
, E  K8 t3 n( W+ V5 ylefttime=setInterval("scrollmarquee()",20)1 u# t5 k! A) u8 Z5 C
}
5 s  ?& R% n4 K& Xwindow.onload=populate
5 Q: X: F: J7 m4 V$ @
' _( l( L/ M/ b. D% g  R% afunction scrollmarquee(){
  ?& Q4 x2 W% c8 H7 X) ~0 Tif (iedom){
3 u% m6 n& X( n3 m7 {; xif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
4 h6 J2 U& r. h# kcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
' Y, n  ]( L1 {" telse
/ Y( m. v9 N' xcross_marquee.style.left=marqueewidth+8
3 a, s: U; J4 i) |1 z
# F8 ^, T0 S1 j9 x3 U}
; C% M: D" I* h6 H% W1 F0 Celse if (document.layers){; [( q' U' ]( h5 q' v" X
if (ns_marquee.left>(actualwidth*(-1)+8))
; g% X  f0 L, T, O5 h5 {# R& ins_marquee.left-=copyspeed3 b) h  C2 i% o) F7 o7 e0 q1 ^
else
/ r6 X- X/ _* ]/ a& a, fns_marquee.left=marqueewidth+8
8 i7 I$ {# R( Y; y' `0 a- H}
- S7 `- B7 U2 C5 B}& T2 {( ]& u  x  w+ o. n, X; \

% t; H- R" ?/ gif (iedom||document.layers){
  S, D) `* f# `with (document){
$ v6 Z$ p: W/ F) }. N- e* G! [document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')/ |4 C. i, i$ s( @
if (iedom){
' X: ~5 \; @+ Y  W1 c$ q2 \$ h. owrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
$ h: K8 Y. ~- o/ V2 n7 I$ @write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
5 ?2 u3 V2 C* ]' d4 c: g0 o3 owrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'). O  J  @$ a* g0 h. S
write('</div>')
4 V4 l, K' [2 U% V9 F, z}
; w! c0 I$ B* X9 R9 u& h5 Felse if (document.layers){
) W" C* u$ N. ~* J% @7 r8 rwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
& V7 F( S" F; H+ H, y6 z, x1 F5 J5 Awrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')0 }" X% h9 d' B
write('</ilayer>')3 O8 ]" r8 O: w2 @  |
}
  n7 c2 g& a3 p' Ddocument.write('</td></table>'). p" N7 e; z+ P* a& [
}2 Y& k" Q4 x" U0 D$ F  w* r9 L
}; h; I& o' T0 w* X4 }$ e
</script>

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