返回列表 发帖

网页之跑马灯文字特效

//修改宽度
! Z9 P6 d. e! ~. X$ m4 gvar marqueewidth=300- e" y. Q, z4 k! D5 |- ]! Z8 x2 n
//高度
# ^/ [& g; x+ M" H, @9 m+ evar marqueeheight=251 ~3 d! [$ z' e9 ^2 c7 _
//速度(1-10): P# `7 D1 P: f- V
var marqueespeed=3
* k( c" x% S9 j3 Y: |4 t9 ~//背景颜色+ `2 c. i5 Y* `  U/ W, L6 @, q
var marqueebgcolor="#FFFFFF"
$ A. ?- V' O0 w' V//是否能暂停 (0=no. 1=yes)?7 Y1 |4 R8 q0 x4 X- k! ]
var pauseit=18 `; W, y! }7 R. p

' Y; s! Q& y* E  J! W) S//修改显示内容
" t  C1 |' n/ [* b# w7 Yvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
2 y: C( @$ q: P8 f1 d# q* E4 {2 o/ O

1 B0 a/ `5 l1 A& z! B4 s! }////下面不需改变////////////6 @7 T1 U8 q! h. i0 y; Q: d- f

8 B' d$ \. ?& S* B6 Mvar copyspeed=marqueespeed3 a  P" k$ z5 h% E8 c
var pausespeed=(pauseit==0)? copyspeed: 0% A* f+ N% v" r% F; H
var iedom=document.all||document.getElementById
$ y8 W% C, L0 I; l2 t6 X: Kif (iedom)
' t5 @) N* Y( a: h: P. a5 }# cdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
- T/ I* D5 ?5 d7 z. j6 |& n8 lvar actualwidth=''
1 Z5 F% h1 r, U4 u6 K* R  ?. Pvar cross_marquee, ns_marquee! K# c) P- f! N& n. P

! C- y, ~+ {$ \" w) [/ vfunction populate(){
1 G4 Z+ @5 R8 D0 V; @% v0 k0 o7 y& ?5 mif (iedom){/ q" A9 i/ x( K/ o( C$ o  G# g
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
) q' ~. f7 [6 {# c  ~0 |6 `9 \, n( |cross_marquee.style.left=marqueewidth+8, m1 \  H  y) V
cross_marquee.innerHTML=marqueecontent
) h; }$ [( G+ Y  Uactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
7 R" u7 z$ K* d  Z( {3 X6 N5 R}" @6 X& R+ l  g
else if (document.layers){6 l; F# y0 T- G$ K
ns_marquee=document.ns_marquee.document.ns_marquee2
* k& q/ m4 b8 D! k- T$ E  wns_marquee.left=marqueewidth+88 ]+ B5 b2 c, k8 w
ns_marquee.document.write(marqueecontent)8 |# O( k2 J5 l- E+ S, A7 z
ns_marquee.document.close()
/ }' r, S4 K) V/ _" \+ Uactualwidth=ns_marquee.document.width- B* y( `9 D+ f' o$ _
}, f8 S6 ]( m  z: l, v4 J. q: p
lefttime=setInterval("scrollmarquee()",20)* {- w4 M6 q' H* ]& S% o" H
}
' H) [( L. L; E, Ywindow.onload=populate9 v% D! f% [$ E. }1 n5 M7 w' Y
; z+ }( F) K8 W
function scrollmarquee(){
4 G! ~: Q% Z6 f- v' N- N& yif (iedom){: |: }& P% Y* l7 A0 u  S
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))8 q/ u: ?2 I+ Y' N' Y8 D
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
% t  b$ r$ @, d- [& Y. T2 \& ?, X' Qelse
1 t! E+ T3 Z- n- Vcross_marquee.style.left=marqueewidth+8
5 `1 k' u' ~5 S& D/ O! H, i7 w7 ]0 i# U! l- V: r
}
$ M. x" H/ }" y3 [: j" ~# Delse if (document.layers){/ N& {% Y, X" A! U
if (ns_marquee.left>(actualwidth*(-1)+8))
! q6 _2 i* K/ A! d1 h& fns_marquee.left-=copyspeed
. U! p2 `  \* F  f4 N1 o! H2 d8 ielse
  t" N. e& D# ^ns_marquee.left=marqueewidth+8
, i8 W1 S- j* i7 W2 o  [& Y6 z% {- H}
8 N( ^. s4 `1 s3 L5 W. a1 A}- h8 D$ @* ^! R6 k5 j) q
# P1 m: q' A( H, t! `5 p
if (iedom||document.layers){' a5 W, X- b0 B/ P8 V5 T& g
with (document){; l- v3 s* E% I; q' T
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
& N& ]$ V! s* X  wif (iedom){  _: V* ]: q7 {' c) I* P! J3 |
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
7 a1 ]/ V7 X' i7 m; Fwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
1 d2 e0 V3 H! H1 R9 h, Zwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')1 u9 j1 c7 Y! S0 o$ B
write('</div>')9 k( r# X" K  ?% h4 e' `. x
}
) V5 Z' C' g# S+ J# ?else if (document.layers){
' k. J$ L! t& S0 E' c, ^- g: Twrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
, A2 @. ?( C* W% n0 e7 |' n$ Z' C& qwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')2 F; M# i/ `: ~- j, n, M
write('</ilayer>')
8 ^9 u8 `3 E9 y( u, K0 Y, ^2 T# k6 B3 D}# Q4 O9 g' N: s5 p
document.write('</td></table>')
# _6 B/ R2 E( }% V, K: P}, T; h8 n; P& H( a. x+ a3 u) x! c3 u
}
. z) b! a9 U1 S, w4 M! c$ @</script>

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