获得本站免费赞助空间请点这里
返回列表 发帖

网页之跑马灯文字特效

//修改宽度, e1 ?" S7 G0 R0 Y
var marqueewidth=300- r5 y# N7 B: r/ c+ }* g
//高度% y) M  H7 d0 p' x0 x
var marqueeheight=25" K- x- ~1 N  ?, O8 R  k
//速度(1-10)
9 u" T! V8 e' f; b" @var marqueespeed=3
) u& g& f1 l# ~9 b( z. c5 o# u: ^//背景颜色
; j/ g. w7 e: t7 Z( u4 k, {var marqueebgcolor="#FFFFFF". s, H  m! `2 X& x
//是否能暂停 (0=no. 1=yes)?
% u' I+ I- b- R6 ]* ]6 I9 a0 mvar pauseit=15 z# J5 V! D1 H8 _

; k6 \  d9 p3 E9 Q, G5 {//修改显示内容" X' f% ^2 X1 p; x; s' V
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
# s0 u) o3 w2 b# S% g) C/ P0 \8 o* C1 k3 h- _
! \$ `4 C7 t9 q0 M# E
////下面不需改变////////////' l: U: i; p" r2 f8 L: P" F! A

7 _) M: r+ T$ |! V8 Yvar copyspeed=marqueespeed
4 ?* R$ f$ G8 i' Q' W7 I3 l" }5 p/ Kvar pausespeed=(pauseit==0)? copyspeed: 08 c) m1 i# |4 W! F
var iedom=document.all||document.getElementById
: y( P% v, c' x/ B+ N0 }, hif (iedom)
/ [$ N% ]6 Q) X0 f4 B/ f- Qdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
; [1 m/ W& n; [! Tvar actualwidth=''* o( b0 c" U9 r& u; f
var cross_marquee, ns_marquee
1 a4 A9 c+ C" g8 w. ]/ S$ n$ z+ d1 S7 o
function populate(){: C( t& F" V0 ~. G4 ~
if (iedom){& Z; `( s* N& p7 Q) J! v4 y
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee* X+ U" _; [$ u0 r. v- i
cross_marquee.style.left=marqueewidth+8& a; T5 r' ^: `: c3 l$ J
cross_marquee.innerHTML=marqueecontent
& y: S' g# y2 C* ^actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
  ?- K0 h! S* k}5 T7 [, x4 v4 H2 U! ^) z# b) m
else if (document.layers){! |8 H* C! b0 d9 b# a- N& X) F
ns_marquee=document.ns_marquee.document.ns_marquee2
/ B+ ~9 L. N* ?8 V  Hns_marquee.left=marqueewidth+8
2 E1 D9 m  W, k- J0 k; Jns_marquee.document.write(marqueecontent)
# ?7 O/ [" e: R. k' {ns_marquee.document.close()
" r3 J+ x& a' A! p/ Nactualwidth=ns_marquee.document.width" n2 q5 o' T/ }) n
}. w* S9 |9 H) a2 s, z
lefttime=setInterval("scrollmarquee()",20)  s$ d; y) v6 q% m) n) }4 O
}& k  L* t/ a- `& j
window.onload=populate
6 E) z% i$ f& X' W0 |( f0 t! n- W  e* m5 z0 w
function scrollmarquee(){- k4 p; z  m! M% ]; Y
if (iedom){5 a: h& G" R) X% G
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
" @! r# {- U% `% h. gcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
# x; |( T) ^6 v: G$ s) q! Pelse: R2 k% B2 e1 o2 H* {3 E4 w4 m3 V
cross_marquee.style.left=marqueewidth+81 ]6 v. G9 k4 ]8 @
. I" D' K& F# M1 g8 ?& u* N7 q- |& v- U
}* v& f1 O3 _4 P
else if (document.layers){
" B9 U1 a, c7 A! w8 gif (ns_marquee.left>(actualwidth*(-1)+8))) ?$ v& [/ b3 t' O0 e) t
ns_marquee.left-=copyspeed( o# i0 K% z! j
else6 N4 x2 u0 p5 j: w( m
ns_marquee.left=marqueewidth+8: J/ M) T5 B" {  }# h! Y
}" D1 t4 J, S1 j
}
' @: s! n$ h+ q+ C. T6 e1 W- v# [5 g4 q6 a
if (iedom||document.layers){
9 {& B; a- h8 ?# P% ?with (document){  d3 n5 J1 z* B: O$ t% i, y. p
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')1 @" I+ `; m! ^' M; z
if (iedom){7 Q2 W" K5 l8 }* i. T
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')& b# r$ K& j8 \; B# x" L
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
) A( v2 E$ n$ I, P) j* L0 Xwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
- K2 |3 ~  P, h* j; ?# y3 fwrite('</div>')* J9 O- L2 O# j  q3 {. m) q
}$ P$ k8 p3 a' g5 @* u; X
else if (document.layers){8 s. O* E: G" @7 @
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')# j% @! l% B+ o, }, y
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'): r+ i% x7 m5 e, S$ I+ S3 v
write('</ilayer>')
2 M0 C5 }" H) d& n, x+ w" O# N}
6 d0 V" Q' ^  V7 j# l4 {document.write('</td></table>')# O$ W9 _# H1 X7 y* X
}
/ s' L9 i! G: A2 ^* T}
0 D, U8 M0 G; k: F- b" ~1 P</script>

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