返回列表 发帖

网页之跑马灯文字特效

//修改宽度
& [: f1 u( }) H, d4 |* {var marqueewidth=300
; ~& ^: K: I" A/ [& h$ s  I//高度
7 h2 P& m! ?# w- rvar marqueeheight=25
" C4 i1 C8 a1 M4 o$ \$ S//速度(1-10)4 h2 W' Q. D8 j
var marqueespeed=3
% c3 }7 I- m9 F//背景颜色
  h9 ?6 Z4 n% Evar marqueebgcolor="#FFFFFF"0 e2 a" _2 L  u8 r( W- W" M- d
//是否能暂停 (0=no. 1=yes)?
- W+ O* W% z9 L2 R0 D: I: @# |# `var pauseit=1
3 T( j; y7 O0 V4 S( z; L& r: z) e  J8 v; G
//修改显示内容
: @& f8 ?: O4 Q2 z' Z5 vvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'. \! V  }/ i* O5 o* w9 b! q

- N: K2 e- \# _3 i' a0 q  v7 b. d1 M6 d0 A6 T
////下面不需改变////////////
( M3 f- u- M/ a; E- x$ C% o0 b/ ^, W! m3 X8 j
var copyspeed=marqueespeed2 [! a% k+ Y+ e! L. \
var pausespeed=(pauseit==0)? copyspeed: 0+ b$ G1 C$ N0 `# r/ M# l1 c" M
var iedom=document.all||document.getElementById
& ~7 Q  t6 \$ ]* a3 zif (iedom)* G. j# s9 e! s; d) y8 X/ U
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'). m* N; h6 T1 W2 \2 S4 D+ h0 j
var actualwidth=''
6 [) G6 `* [9 ~' G% ~, mvar cross_marquee, ns_marquee
( N' H+ T6 w3 q; y, `5 g
( W# K4 Y5 I8 @, ~- u, ofunction populate(){
! W8 `9 K3 W0 O$ O. G9 Kif (iedom){- x* U0 E( V, U6 U
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
- [; e0 R* c: ~cross_marquee.style.left=marqueewidth+8
4 M( i& }) c" B9 W+ tcross_marquee.innerHTML=marqueecontent
+ P/ w+ z# u; j2 l1 B* U$ z' e* Nactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
# P! E" Z+ s- B: y}! N# n1 x, C1 z9 @4 A
else if (document.layers){: ?& Y! N. k2 q0 m) n
ns_marquee=document.ns_marquee.document.ns_marquee2, g. b; T0 ^) ~5 m% k" F( d  [
ns_marquee.left=marqueewidth+85 p; s  K7 W# D, @+ ]
ns_marquee.document.write(marqueecontent)
  l# I! \% w# J1 r4 _) l' |ns_marquee.document.close()
* w- s- A$ L. c. x# e% u. [actualwidth=ns_marquee.document.width: ]0 O7 Q& j, K0 C6 H; [1 j
}4 f3 C& I4 z8 g3 O4 g
lefttime=setInterval("scrollmarquee()",20)
5 J# Q$ S+ m# d# }! E1 l1 C}' V5 I, W9 z2 P  K
window.onload=populate+ I/ W4 H1 V# B- E1 o& J. O6 w

1 a( Y2 S4 \0 n% I. k& U# N! j3 Wfunction scrollmarquee(){& y+ G* c- L# ^
if (iedom){# s3 ?. e7 t% e3 k6 h( B
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
" h8 Q, ^2 U8 V( u% M& @1 xcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
$ f5 E3 q" s1 z- pelse
" F; ?. s# l3 O& ]& [5 @8 Qcross_marquee.style.left=marqueewidth+8
+ F9 v( T# J, k8 Y( F! y+ n, {
8 i# E6 G6 Q8 f9 d}
" ?; {6 \1 S4 `8 u; _" M; Z% b5 Felse if (document.layers){- \) ?8 q% i1 H8 @
if (ns_marquee.left>(actualwidth*(-1)+8))
9 I- `6 J0 y4 r, \, }  c% M$ e8 nns_marquee.left-=copyspeed$ O; q+ ^: C+ ^- u
else+ H9 L# g' @. s/ Q* f3 r! G
ns_marquee.left=marqueewidth+8
( C6 X; L+ x8 s3 c+ j, W' |}
+ \( m1 @" n  b$ J}+ P, @0 h- Y0 I( j7 j0 @
- O/ s- b1 Z6 p+ v% m
if (iedom||document.layers){
' A% |0 q  ~7 Swith (document){% ~9 c* s0 _2 d7 W
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'): _+ o% \+ |+ m# R
if (iedom){
5 \0 U4 |9 {: z: ]) s7 Bwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')/ `2 T* [2 L$ t( `
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
7 ^" ?6 f2 Z: R& D6 W4 Ywrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')9 S1 P; S6 w. @# Z, e1 Y2 l3 _! b
write('</div>'): |) ]% _* C+ y* l! P
}
$ e# V: C% ^" welse if (document.layers){) L/ z1 n: m0 k% v
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
# B; y) ^: ^; D! O* e0 @; Iwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
) i5 W7 P/ w7 Y2 ?write('</ilayer>')) V( H2 P& O+ u1 u5 r$ D+ r9 o' M; `
}0 h' z! F: f  ]" A$ d1 N
document.write('</td></table>')* _. G; S# `' u, J
}! P$ I" x" ^/ U) @- J9 x  o
}3 |; j$ a1 @0 {( r5 U, y) ?
</script>

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