返回列表 发帖

网页之跑马灯文字特效

//修改宽度
/ M$ }$ d# G3 S  O6 M8 w! |var marqueewidth=300
, A5 w. `* w3 [2 C$ R% ]//高度  |7 G& O* u3 u& q& Y9 j% M8 K
var marqueeheight=25* o  O$ b5 w2 u0 X( s- |8 @2 L
//速度(1-10)
5 p2 d5 k. ~5 n& ?var marqueespeed=3' S! Q) f0 ~2 L- |, F" h" v$ n$ n3 N
//背景颜色) g% v# n! z; I
var marqueebgcolor="#FFFFFF"7 J; C3 }+ _9 J% G( N2 L9 M' I
//是否能暂停 (0=no. 1=yes)?
5 K5 l" @3 p( T' Rvar pauseit=1
7 M/ T- c' I" z( A6 o* b1 y8 j1 H6 s) n1 P
//修改显示内容- I* b( D# K% Y) Y9 M& d
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
2 O. a9 ~& ], @$ I; W: ?1 L! z0 }0 q) i
8 \$ r) s) B) |" v% S" v) S; U5 e
////下面不需改变////////////7 d% D) U/ m& K! O" W% }

+ o" l) `; A/ K1 U, l! Qvar copyspeed=marqueespeed
: w$ x; i, X' q1 kvar pausespeed=(pauseit==0)? copyspeed: 0% n" I5 N- n, p
var iedom=document.all||document.getElementById  s# ~3 h  t" @. ^) }
if (iedom). U: z1 ^; \% Z) |* A4 Y
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
9 R: N: M+ r5 H3 o- c) H% C) ovar actualwidth=''7 r4 ]  r2 U6 T! Z6 u+ n
var cross_marquee, ns_marquee
3 U$ K' h" Z# d' y  |- G9 w! O
  H' r5 E- L  x$ F3 C) @4 ^function populate(){3 A6 e( d' V4 g$ o$ V* s- n* L
if (iedom){
6 Q, O- E1 w% K/ I3 y- h1 Q9 }cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
2 }0 g7 i; O. V. M. Ocross_marquee.style.left=marqueewidth+8
- i  I" Y3 i/ k0 |cross_marquee.innerHTML=marqueecontent
/ W' p: ], O. aactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth* t( D% l6 p0 U) C
}
' g9 c7 T3 q% n# R1 J+ E6 \else if (document.layers){  i  U* {6 o: D4 G$ t- s. V
ns_marquee=document.ns_marquee.document.ns_marquee2
6 Y  Z+ A+ J" D/ u7 @ns_marquee.left=marqueewidth+8
; q0 I& p: |, i3 }, Qns_marquee.document.write(marqueecontent)
( M3 U6 z  _% ]! X, Cns_marquee.document.close(): C: Q) y3 A. Y9 H
actualwidth=ns_marquee.document.width
# v3 W& I7 W4 u6 Q; K7 P% N1 a0 H}
0 s  n0 `. Y) L& q. K) K- G1 Mlefttime=setInterval("scrollmarquee()",20)
+ ]- U7 X% j  K6 }$ z# i& P  z1 q}+ N0 ]. [# M  h9 u* ?9 a% t$ n- X( t
window.onload=populate
* ~' R: R. w1 Q6 ?) q
( `# w/ `2 J$ y; d7 Gfunction scrollmarquee(){( \% i- m. V' L5 `" Q
if (iedom){1 {. m$ p" j; ^4 ~4 J
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
6 y5 v" @9 u! B: b7 M1 Wcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
; j' U5 E2 X1 u  I" X: {0 D( Felse) H4 v, S" n/ \- r
cross_marquee.style.left=marqueewidth+82 @2 Q( i7 J4 ]

" F7 X; R5 L5 z$ n5 a}
% U8 a3 J, O# ?6 W* q2 x0 J7 F8 t. @else if (document.layers){3 Q! ]0 _; M, F* U3 y+ h0 m
if (ns_marquee.left>(actualwidth*(-1)+8))" C! l! s, Y% `
ns_marquee.left-=copyspeed
/ Z2 b2 `$ v$ }4 Yelse
4 `- H8 \, J9 C" R  Qns_marquee.left=marqueewidth+8
! S; `9 W; M( a! M7 X}% Q. Y% Z9 V9 j/ {1 g+ u1 f
}: W% u+ c' U! U- ^$ L
9 p: j- Y5 K7 t7 b- n( l& x
if (iedom||document.layers){
) G8 ]% j0 l- d( `+ swith (document){
2 t0 a! h6 G; `9 U# ddocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')3 j0 b5 k5 M- b8 _0 V
if (iedom){1 r7 {' m1 Z7 A% l
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')$ C, ]; N# _$ d5 h+ Q0 X: Z
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
6 B9 _1 Y' ~, K# Swrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
8 E: Y8 M; C1 T" l& jwrite('</div>')% o1 ^6 S* k# ~0 s' l& g3 A
}
( K$ s. e% h/ b. k' jelse if (document.layers){
# `2 y# x) H; [  I) O# Uwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
- c/ ]4 Y6 n9 Q* Cwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
) ^( B5 c$ L4 @6 Z9 N( j- |( hwrite('</ilayer>')
) W7 K  i0 I; F) A; Z}3 q% \: l0 V1 A2 c
document.write('</td></table>')
/ o3 y  Z# x' F" t}# v7 ]5 }; T9 F# E3 k* }5 V
}$ n8 N) [: _' I. q1 o# [
</script>

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