|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度
/ n) Z \$ z# @5 l! j# wvar marqueewidth=300
- t. L: Z" q$ C& w//高度
* ]: L. L/ M( Q/ z) jvar marqueeheight=254 X i, b8 ], G; v
//速度(1-10)5 h. w3 l) a2 T2 Z
var marqueespeed=3* K+ Q9 u8 j0 r |$ ^$ A- }
//背景颜色- ]- S1 p9 |$ D+ C/ ?& l2 B
var marqueebgcolor="#FFFFFF"( S, x' z3 {# M* N) h2 W7 E. B! g
//是否能暂停 (0=no. 1=yes)?
* H* H' J2 U$ j- `+ h% F( ~var pauseit=1# m; W! H, I' Y- J" G
8 ^' Y0 u9 g3 g; a. u
//修改显示内容* Y0 {! N- U: v
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
6 p, P# y, R: D: b9 L+ b' @7 I# i M1 o& e( A9 W
0 R+ o U# M" f' a' m1 n////下面不需改变////////////
- _3 I# z+ b5 v) ?) q% ?5 Y$ q8 E/ ]/ T+ H. i+ W9 A( e3 s; R
var copyspeed=marqueespeed- |# b3 @6 l. _5 I1 i3 J. Q9 `
var pausespeed=(pauseit==0)? copyspeed: 0, `' i' R& d. G: s
var iedom=document.all||document.getElementById
. Z6 C1 _' u* ^3 oif (iedom)
( F; w5 K# | v) B1 mdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
, {# @. }; }6 U! u3 s. {3 ?& {var actualwidth=''; O5 ]- w5 K+ n) f: L& K
var cross_marquee, ns_marquee
* y# n8 w( O' `* V3 M9 u2 ?1 Y8 n7 A; h5 D7 h* h9 z) i/ g1 ]7 V
function populate(){& ~( @ q* y# n2 ^) H6 Y: I+ g
if (iedom){8 m5 o$ N+ k6 C
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
( E R& _* I% F% Ecross_marquee.style.left=marqueewidth+8; T: I6 }! l4 Z, b# K' p' q9 i
cross_marquee.innerHTML=marqueecontent
' h: Y) r) G/ [! n2 uactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth% E3 K/ A$ h: l( y0 c7 T: h
}
" J. Q6 Q8 d3 F- d% ~/ R) lelse if (document.layers){9 ^# G0 ]% ]) e5 r- i% b& t
ns_marquee=document.ns_marquee.document.ns_marquee2
' A8 w: Z# x) I1 |# `' e. t; ^$ C+ yns_marquee.left=marqueewidth+8
7 P. r9 ^7 w8 d. }7 a; pns_marquee.document.write(marqueecontent)* s5 d5 {1 L/ h" ~1 l
ns_marquee.document.close()6 Q$ c0 x) O5 [& {: k4 a
actualwidth=ns_marquee.document.width: \ H" P/ x! i1 F7 m8 q ~9 z
}
$ q' @. q; v: D( f' dlefttime=setInterval("scrollmarquee()",20)
/ q: x, H5 c( Q5 X& I}/ ^$ F d0 `8 F `
window.onload=populate6 P' l3 \' ?! W7 s% S7 j
& \/ o0 @4 t$ g6 N1 [ r/ `function scrollmarquee(){! s$ G& T* z+ C! O) ?
if (iedom){5 I3 A# d+ b: P( b6 Z6 Y! X
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
. Q5 m$ {- ?, z) X% X6 j. g9 ~cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed- ?5 u. g, V, T( i
else7 f+ r. i: m, [' J0 t5 G
cross_marquee.style.left=marqueewidth+82 `3 x" ^3 _. v
0 `; [; {6 P. w f& ~- b) `- q& X) O}! v2 L% K8 G' x* s* \
else if (document.layers){; ]4 V- T1 G" F) W
if (ns_marquee.left>(actualwidth*(-1)+8))5 |$ g$ w2 s/ m0 w4 h
ns_marquee.left-=copyspeed4 R4 f- e. \0 I0 @8 v
else1 r/ {( y% ]+ Y* M' F
ns_marquee.left=marqueewidth+8
! t9 L: ]. p* ?6 j}
4 ~3 Z+ C, U2 Y: h}. Y" A, {$ [" G3 M
# s( W; B$ S7 Y3 @; v. Bif (iedom||document.layers){' c( O4 C' e- Z9 Q6 B, ?0 i
with (document){
7 E4 C! J, k+ o9 p( d2 P0 Idocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')! F; T# D0 i4 N. z! ~0 @) H
if (iedom){& C7 X% b% |9 n0 N3 n, S5 |. I: P
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
8 W" C+ ]% Z0 {: Q' L' x4 awrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')# ~( p8 U8 t# C" ^" ^) c
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
: E2 z9 j" |- m+ ]write('</div>')7 ?6 U" C) e7 l$ } g0 f; Z
}2 U8 ~( c. d9 j7 P6 V+ w4 w
else if (document.layers){$ y9 O/ Z, D0 u) t
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
2 K1 \+ C/ j$ r" \write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
9 p5 H: J( r+ O) B. c# W% n! cwrite('</ilayer>')% Y6 V9 d: I" C
}. B, F8 J% `7 }3 s+ M0 T
document.write('</td></table>')
$ t; y* z8 V- P! Z# n5 x}
, n2 e! W3 f: l ~' y( }1 g Z0 w}
- P; U9 u& L- z J! C( W</script> |
|