返回列表 发帖

网页之跑马灯文字特效

//修改宽度5 _6 l6 P9 Q. Z( ^3 d. D1 n$ H) y+ n+ W
var marqueewidth=300. L! e) Z# }" s. z
//高度
4 @% t5 w% w  \& r3 Evar marqueeheight=25
* i" f. b2 x- G$ _, K2 Z//速度(1-10)
% Q+ M: X8 X; J- Kvar marqueespeed=3
+ R4 v+ Y* b: {7 O/ V. g//背景颜色0 v& p+ k- |! g' w, B. ]$ _) I
var marqueebgcolor="#FFFFFF"
% B  p, t% n5 m  P, M. n, M) J//是否能暂停 (0=no. 1=yes)?7 j3 i" U4 ~, h0 ?. M/ O* Y% ?
var pauseit=1  D' k  W/ }- u* |6 k: H/ x
4 y, K( D, d. x- z! }5 P
//修改显示内容* C7 E0 `( l! J! U( C
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'0 X, `" R1 f1 v1 E

9 @' w. n# U6 [& k# O: ]/ Q6 U- V) `# Y# l" u
////下面不需改变////////////" c8 M  [4 a) h- p

$ x6 x* Z8 `: z' n7 U) mvar copyspeed=marqueespeed
& I: e4 |  w. p8 X' H2 x' Dvar pausespeed=(pauseit==0)? copyspeed: 0
9 }5 E: ^+ s7 o: X7 x# d, rvar iedom=document.all||document.getElementById" x/ n& D3 G& }, E
if (iedom)
/ w" E4 o9 W0 x8 a- F) s' fdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
9 G+ _  [4 g( c9 f5 zvar actualwidth=''4 L) _0 n0 v2 F3 g3 ^8 a' X9 P
var cross_marquee, ns_marquee* w1 ~2 S* ^% X) ~" S) Q9 ~! s

0 h4 t7 x: G) I5 ~" G. `7 lfunction populate(){
# k9 C+ M. j6 @1 z& B4 Tif (iedom){7 Z4 L/ G9 C1 J: l! w- T% \
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
2 n( d; a& h9 @cross_marquee.style.left=marqueewidth+8' L9 m9 O$ Y* `0 ]4 a, N; U
cross_marquee.innerHTML=marqueecontent4 p- G8 _9 n2 q& M
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
. e8 V7 N* X3 c4 ~}
7 D4 s3 K  \. `else if (document.layers){
0 ^: m' I; Y7 l6 Mns_marquee=document.ns_marquee.document.ns_marquee2
$ }+ s3 x5 B( ~' s+ |ns_marquee.left=marqueewidth+88 H& h5 `1 a! T1 w2 o
ns_marquee.document.write(marqueecontent)0 V, T( `2 \4 s& C$ G
ns_marquee.document.close()7 B) v. D* X. w- s4 H7 l: h) |. \6 X
actualwidth=ns_marquee.document.width
' W3 f* `+ B) T8 u- L}
# m! k% ~& Z! p8 I( |lefttime=setInterval("scrollmarquee()",20)
1 F: F( H! B( [& R; t4 r: F}& k# s0 n- F# {3 A/ S! M2 A
window.onload=populate2 {; A7 Y- U& w4 s

# [" T# e- n. Y$ m, f; q3 I) Gfunction scrollmarquee(){
$ g2 m: r5 y7 N8 M7 Z2 {if (iedom){/ c% a" H0 c& v( {0 P
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
! ?- f0 f% M# x1 z+ h. Rcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed6 Q/ }7 p6 f3 h' y
else# y' |) F# I  e- T" g
cross_marquee.style.left=marqueewidth+8- G" ?+ k3 a+ O: Z) Y

7 G$ R" N% J( \, _$ e}' I$ i; a0 f$ z
else if (document.layers){
" O! Y9 v; A) }/ a3 W0 W! W: j  C: gif (ns_marquee.left>(actualwidth*(-1)+8))! u  y% w  j% h0 k5 W
ns_marquee.left-=copyspeed6 Q) g  l" k5 }- g" y
else9 k8 e% l- u: h5 m$ X  M
ns_marquee.left=marqueewidth+81 L, v4 @$ H5 `6 F
}
7 k- g' {2 z0 ~& m6 `1 x}
6 ?6 Z) d% |. W- W& a
; y0 N( q2 l3 W& H7 c( S- m$ pif (iedom||document.layers){. f1 u& A) K0 J! A
with (document){' c  J. ]- K8 H3 \4 A: E4 X
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')2 v7 U8 Z5 m- a) Q/ i9 A* h5 d
if (iedom){
& D- m& k5 J( ~! b7 twrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')5 O# ~, ~9 q$ X8 V8 d6 z* }" P
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')- N: j6 t$ M0 j6 E* Q  K7 ~( w
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
" I7 y# @0 k0 K  A2 s: bwrite('</div>')* m8 H$ P) w  W; \3 E
}8 K6 [: X  k2 @/ J
else if (document.layers){
* k* d# o' }$ A. H3 ?5 Fwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')$ F' ^+ K, a+ l6 m
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
; ~: c$ ?. Z: y/ s: [write('</ilayer>')7 E) [) G* s: Z( p) f" ]
}
7 f% j3 i  `& ?, ]* idocument.write('</td></table>')% q7 C* U3 C( |- b) C
}
+ |4 C* y  E8 ^, a}- }) N, o1 w7 ?; i: b
</script>

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