返回列表 发帖

网页之跑马灯文字特效

//修改宽度
5 \+ m& x% P, _; a: i, Ovar marqueewidth=3006 U1 q0 _4 i2 X5 \! T
//高度, u! q& d! Y: J: N
var marqueeheight=25
- C- Q, r  r$ C# Y# I1 ?) d0 O. |9 m//速度(1-10)% y5 r/ G' D) k2 j
var marqueespeed=3
, r3 q6 V, n' x- w//背景颜色. S6 @( c; }& _) j7 L7 K) v0 d
var marqueebgcolor="#FFFFFF"
6 H2 {. v  c. n1 y//是否能暂停 (0=no. 1=yes)?
$ Z6 R- K8 i3 Lvar pauseit=1; d) J0 r8 U6 K& C/ G

1 r8 b5 z( L) a//修改显示内容1 E; P0 A, X3 U( K# n/ h
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>': x; M0 v, e! s, v, V
; F, y( {" ?- H+ [  O# u

4 X) c  k- f* ?. M////下面不需改变////////////$ t( b" Z$ X9 h: _5 k5 d

( _% X; ]3 ]; r0 m3 D) [' h/ R0 Gvar copyspeed=marqueespeed
3 e; z2 v. f$ ivar pausespeed=(pauseit==0)? copyspeed: 0
1 \: |4 Q  e. r9 p, l) _/ J( Avar iedom=document.all||document.getElementById7 a. ^: }6 ^) O! N" R9 M
if (iedom)
: o1 y" T, [* f: k7 t3 o* n8 k% kdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
2 e7 k6 S7 P  E- k4 Y9 @; Pvar actualwidth=''5 x- X" f/ ~& n* z3 T. |: R3 E
var cross_marquee, ns_marquee
0 _8 G% o0 K6 a1 s# ]) w1 e) a, [/ D6 P/ a7 g+ n& b
function populate(){) r# p; b8 u. X( ^$ {+ H1 r
if (iedom){
% R) a. R' k( t' xcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee/ S' D3 A. Y6 H$ y. x
cross_marquee.style.left=marqueewidth+8
5 ^( x1 Q* r& a0 w/ J0 m$ r2 bcross_marquee.innerHTML=marqueecontent, v7 Z# q: {0 r, I) o7 P. l
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
$ x5 v5 w! A* j}- X( x& {; ^% m/ h
else if (document.layers){) h7 L; @3 ?/ T  k% y
ns_marquee=document.ns_marquee.document.ns_marquee2
4 {7 {; c8 C; W8 ~5 M) kns_marquee.left=marqueewidth+8
( C+ Q1 p# p8 n" q. `* tns_marquee.document.write(marqueecontent)# E9 ]  A* E: E
ns_marquee.document.close()
7 C9 F" @& H2 Q$ dactualwidth=ns_marquee.document.width
- Y1 [6 `5 b5 p+ q: G}
4 c4 U" ~0 j; Glefttime=setInterval("scrollmarquee()",20)
4 D; R$ ^7 g! [% j5 A; j}
+ @. R; M  L3 v/ J7 K/ Swindow.onload=populate
: u8 F+ n# t( L# q5 G2 @
# @. F7 W3 |- w! }; xfunction scrollmarquee(){
6 H# h2 M. \5 a! b$ Pif (iedom){
, n" _* N# X: ~6 hif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))( A8 m. ?" C& N0 {# p  w
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed) S4 F8 \' i$ a/ T- j8 y
else
  ?, }/ d4 S& B1 ?  M3 L7 M, ocross_marquee.style.left=marqueewidth+8; D8 q* c; J. `0 R1 q- R) e
+ N, ?9 j9 V& c
}( M1 u2 X' H% I! L7 t
else if (document.layers){/ [2 a9 O% ~$ z! `" W- |9 `' I
if (ns_marquee.left>(actualwidth*(-1)+8))) ?) ^- [. z8 t
ns_marquee.left-=copyspeed
6 n' I' q6 }" C% z. l% z& ?else
. }$ l# ?& Y( }5 bns_marquee.left=marqueewidth+8, Z( F5 c) |0 }% w% {
}7 ^( |9 R' Q" h8 S1 g/ x& \
}8 H6 k  Z5 B* [; H. n7 v" `2 g2 L6 N

; o4 N3 |  A" n' ?+ Z: Vif (iedom||document.layers){
' B& ?; J) S- k+ n1 Awith (document){
7 h+ k6 J$ D- {document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')2 L" X+ r# X! c2 f3 A
if (iedom){% T! c9 q2 r$ c2 Q4 H  Y( T* a: }. H
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')7 t& n/ l, j0 q# w6 c9 a
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')" ]; t: i4 O8 O+ I
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')0 [* T7 `1 m" o) c- b) n
write('</div>')
3 b# A  _8 N: h  g. s4 H}
* W+ ^, l& o$ Telse if (document.layers){
+ P* p, ?5 q7 Dwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')$ l3 |9 `2 x3 U
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
. j" v$ p+ q1 d4 q+ Swrite('</ilayer>')
0 L: l6 B. U' {}
% \* Y. P' Y- P: Y& S7 E' D5 Jdocument.write('</td></table>')
, a- G: R, a5 O7 S  J}: k7 ^2 g3 \8 O" d5 k
}
- v6 l/ p/ j/ q4 K, {+ \) K</script>

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