返回列表 发帖

网页之跑马灯文字特效

//修改宽度
2 v! N# w& \# T# [7 A1 avar marqueewidth=300
5 @) B" z& F. r# E//高度6 O, |' l- x, |  v( r, Q; y' U0 C
var marqueeheight=25
6 J  }( S8 B; C" `- m" d# P//速度(1-10)- ]+ t% M4 k' L+ y9 h
var marqueespeed=3
1 E! m; d  m. {6 J) b* O//背景颜色* F4 p0 c; u8 u" K" L9 @2 v
var marqueebgcolor="#FFFFFF"& J0 n% L- H. ^/ u6 N
//是否能暂停 (0=no. 1=yes)?
# k0 z# I' o0 N2 e7 I9 vvar pauseit=1$ ]8 u/ r/ k$ }% \

8 T+ v$ m- W% g2 z$ v4 H' @//修改显示内容( ^1 {* R: e$ x# r  R: r
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
  k8 @5 j& R6 P' k# n1 y: U
# \) ^. k8 A) U: F9 N# U
* x# K, J) Q2 W, P////下面不需改变////////////+ [' ~8 ]8 M- x
: b6 R$ I- O2 }5 f- @# U
var copyspeed=marqueespeed
& I, ~% ~" K# y+ J  l- i* uvar pausespeed=(pauseit==0)? copyspeed: 0! z: V# c& O! n* E( e- i/ i
var iedom=document.all||document.getElementById- ]- }: j" @& m) m, L- [+ W( h9 D9 v
if (iedom)
) o4 a, e  t& d! Z& ]2 g4 A, B% Ddocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'): {' H* k0 I" O
var actualwidth=''7 J' x/ O- d% n- @# ^. u
var cross_marquee, ns_marquee
% d, n" p4 ]6 d9 B  D6 ^* c; r- j1 W  h) J
function populate(){
7 W  Q  q+ o/ G* _, }if (iedom){
- z7 A8 U, ]9 f, f: q) y2 q/ V( ccross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
! U: H* Y, @  icross_marquee.style.left=marqueewidth+80 i: Y, P4 i" h3 c0 l" s9 |! F
cross_marquee.innerHTML=marqueecontent
& \4 u7 t" I- A% Q' z% d7 Wactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
" l1 y7 l, V7 ?# B' [/ _}% a! q& T# Y+ q: s" d9 R! u/ i
else if (document.layers){
+ S: [4 p7 v& g" t2 \ns_marquee=document.ns_marquee.document.ns_marquee2
& e) e. }7 o" v" s6 l" dns_marquee.left=marqueewidth+8. y! l% v+ v0 g# U& e% u
ns_marquee.document.write(marqueecontent)
+ A/ h8 {. k: e  J, F; {ns_marquee.document.close()& Y8 m$ N, S6 s" ]% N  I3 T
actualwidth=ns_marquee.document.width
  U7 g  D. b- v' N5 \6 N}
7 N2 J. C0 S/ d; F) [* s, D8 klefttime=setInterval("scrollmarquee()",20)
* |. l# F5 `0 H1 ?}
( \! t, Z" z4 ?- Jwindow.onload=populate
( [# X0 @5 T6 j. }( i- R2 q+ g2 f6 y7 @, }, n9 \! I
function scrollmarquee(){1 k4 c  N9 B8 F+ t5 Y+ `
if (iedom){, i, I6 p  J" b" Z1 |
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
0 c6 y6 ]  P( c% \# Ycross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
8 Q0 e' c9 Z4 [3 O8 E- m& Zelse7 s- J3 c3 D$ Y
cross_marquee.style.left=marqueewidth+8
  _# s6 C2 ?" h1 X% l7 r0 b- x  Z, `  {! \
}
  u3 v5 ^) u  f8 p% P& O* E; relse if (document.layers){
2 Z/ V% F& d1 w, P! e0 Nif (ns_marquee.left>(actualwidth*(-1)+8))
/ s$ I# T. f# ins_marquee.left-=copyspeed
: ?. J7 n- g3 |: E  F6 O! }) h1 Melse; C# F# x9 q' L- Z3 O
ns_marquee.left=marqueewidth+8; f; z2 }, D/ A& A% _
}  H" Y# m. m3 E$ d. X3 O/ w
}9 ?2 g& m$ p1 \$ O
1 H, p% f+ W4 u( v
if (iedom||document.layers){
* A  F6 d' \  P  q+ Z0 c& h# wwith (document){& Z6 a, U' S6 J4 H7 B
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
+ r" n3 k* M1 J& j' w# Gif (iedom){% h: N2 m) E/ P/ Z
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')1 T) x! Z$ w1 M& u; q
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
& }: R( k# t0 p$ j/ B8 H% ewrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')( X3 H4 M- r9 l- o2 \" I
write('</div>'), y3 \; l1 ]/ u9 ~  K
}
; m# ?+ A# ^4 J: j, _4 Celse if (document.layers){
+ }* n: B8 j1 N( i  X( N+ Kwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
; @% K. a2 n  r7 E" T" ]write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')3 N  o& y3 Y4 [3 N
write('</ilayer>')5 D' t) G, j/ V2 R7 h
}7 q; z" \) s' n/ F
document.write('</td></table>')- K& T* D$ r# B
}
: y: x- J/ y5 h}
1 x: n8 _4 ~% O5 c1 R</script>

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