返回列表 发帖

网页之跑马灯文字特效

//修改宽度
4 ]* l: Y% Q2 H# I- v% l4 h  z) kvar marqueewidth=300! Z; j5 D3 U. ?! d! s% G" G
//高度7 h% C+ n$ g2 D% h/ L' P/ n
var marqueeheight=25
" j; j4 Y* p% w3 J; q0 a//速度(1-10)3 x& J, Y( L) }+ [  j  L8 e" O
var marqueespeed=3
  }, Y6 Q* c, x) ^//背景颜色( W" n/ Q7 a. i9 a2 W( a) R; B
var marqueebgcolor="#FFFFFF"
. z9 \" h3 b4 \/ i//是否能暂停 (0=no. 1=yes)?- ?3 l/ X( Y% E+ e8 d% {, r/ R
var pauseit=1
6 j" J; f) H7 F3 b
  V# m8 m4 ~7 ^0 |. I& ?' E; M//修改显示内容
" F7 P3 ^' i  ~7 uvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
% a1 \, R  Q8 S$ _2 A0 j, u1 `) }$ l: o5 v/ J7 D- K% C
4 h: p% K2 N: b$ t0 ^) k' \
////下面不需改变////////////' Y; i$ F; P6 l; Z& r4 Q& v  t
6 a7 F2 j' ~& O1 l$ N# d; R+ X
var copyspeed=marqueespeed
% \; |! B  @* fvar pausespeed=(pauseit==0)? copyspeed: 04 x0 [  j# z  x* h" W0 F" V
var iedom=document.all||document.getElementById
" o/ i$ r5 G7 S: x2 eif (iedom)% a0 u: ?. [  u  B8 `/ f, N( i
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
6 p( k5 x1 m; `+ R9 q# E4 h4 e( @var actualwidth=''
, F' Y7 L8 q. E7 T- ^var cross_marquee, ns_marquee
$ W5 i* k8 l9 c5 i. y
6 f8 u1 c) ^7 j7 B# M. z6 Bfunction populate(){% R. h; O9 a! u  e/ D/ {. |- A
if (iedom){4 m5 G' _6 g: j: w2 A9 F
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee  F6 M; F+ X+ p4 i! g" b. g) @
cross_marquee.style.left=marqueewidth+8
) n& e% K" p3 }$ a0 _3 [! _cross_marquee.innerHTML=marqueecontent6 |, T( j5 U) q% ^* M
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
% G' M; M1 F% ~" r" ^& G2 N- S* X}. Y6 P0 P$ ~8 }4 t  n" n: @
else if (document.layers){9 f, p! ^3 `7 Y9 q
ns_marquee=document.ns_marquee.document.ns_marquee2- d' g8 x& A+ O8 g" X8 `9 E
ns_marquee.left=marqueewidth+8
6 I5 P5 F$ a! C, z* mns_marquee.document.write(marqueecontent)
8 d* u7 x! |2 Y( ~; v4 e, Bns_marquee.document.close()( O& f( r/ `, |2 n; y+ {+ Q
actualwidth=ns_marquee.document.width6 A: {6 a7 ?& B3 \
}( W1 |5 `9 F$ F! h0 H  r0 U7 ~2 Q
lefttime=setInterval("scrollmarquee()",20)
/ [, C! m+ M1 K, i}! ~. a2 S# T9 e7 Q! r/ V7 o2 e
window.onload=populate* B4 X% A. C: x' Y  ?) L* t( d

- c  a. _& w1 U7 c# Gfunction scrollmarquee(){6 Q$ w4 m6 H  h" }
if (iedom){
( a$ q* n; o8 ~) H" V) `if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))0 M$ p) U0 B8 ~$ s5 _& l1 k! F( K
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed& Q/ j4 S- G6 @+ y* I! s; y
else- k" z& n' h. G! J
cross_marquee.style.left=marqueewidth+85 ~) K" U1 E/ b' L) a+ F
1 F( H" D# S3 I
}' G* f; j8 ~5 ?0 \% Z! i; e8 y$ c
else if (document.layers){! }4 h- D$ W5 O2 }
if (ns_marquee.left>(actualwidth*(-1)+8))* v8 x$ c. X8 @1 ]
ns_marquee.left-=copyspeed
. k# I. ^" |2 w5 h' Gelse# K9 V, }/ g. R+ {" K! j: p
ns_marquee.left=marqueewidth+8+ W; D: G+ T/ c! a3 S0 V
}
  V3 R/ w  J1 u; \; W  `, O% X% g}3 X$ }6 w6 m$ ?# \' y2 Z
. t) i1 Q9 ^- @8 Q
if (iedom||document.layers){5 T* a: G9 `. f$ e6 y
with (document){
9 S1 r% v- O$ P$ x; m3 R' c0 t6 r1 {document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
4 D2 Q: _, ^2 }0 vif (iedom){
/ W) I, z# ]. n' d; d9 U) cwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
. L% B8 Z/ m7 {; d" I$ Uwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
. M0 f# f, i& r3 [1 p% ywrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
5 ~! y, m* e/ v- Mwrite('</div>')
( [5 D$ U, Q6 j! [}
: T# m, h& _, H9 p6 celse if (document.layers){2 ~' f1 _6 i4 U/ J# w! K. ~) Q
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
! M7 M6 }" U! u, x, dwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
( A: _' G1 A6 c( Z; N% ~write('</ilayer>')
2 U$ M. z9 k) X0 ~}
, j- D; }. Z. {! i) ndocument.write('</td></table>')
# ?* c! a8 [3 ^5 c& x# @}) Y2 d1 W! t+ T4 W0 @
}
; {" C$ B4 l9 {8 z  S, g</script>

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