返回列表 发帖

网页之跑马灯文字特效

//修改宽度
/ X2 P+ C7 j* F, f( |: Jvar marqueewidth=3008 {% ~" \9 t8 y: ~
//高度$ x" s2 A, |" _" w
var marqueeheight=25
4 v7 {- K, v6 c1 A$ ?3 l' n" o; i% P//速度(1-10)
- c  H8 T2 P3 k+ u& \var marqueespeed=3
3 }$ e/ _9 p: y- x//背景颜色" l; f5 m2 }/ V
var marqueebgcolor="#FFFFFF"; E6 Q  f4 I( V- l8 k
//是否能暂停 (0=no. 1=yes)?
! `! e4 i0 |( c9 D  Uvar pauseit=1. w) |' t) p0 R
9 M, ]5 W& B8 h, s9 w' ~  x6 F
//修改显示内容
5 }1 M8 B4 O( h! B' Pvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'" ]' O9 S/ Q! ^, K
9 B) h. F6 e  n% h; W3 l
' o! {  x  i& {" O3 Q. I4 S2 w; ~
////下面不需改变////////////* u9 U0 h# g6 E
* Y+ y1 B4 h# y' c; S
var copyspeed=marqueespeed2 Z- I! z, P& I( h( z
var pausespeed=(pauseit==0)? copyspeed: 0/ F: P6 R# Y- b3 n
var iedom=document.all||document.getElementById
- _/ l" O# L2 \' l% {! Pif (iedom); V- i* U" ?* c' @& _6 t; N
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
* S3 i1 |: |. {var actualwidth=''+ [+ D5 R6 b+ g) F
var cross_marquee, ns_marquee
* k& d8 b1 X3 `, R7 u% {, E. _0 U" K+ D
function populate(){5 F$ Z. E7 g% ~1 K4 h" h
if (iedom){. _, E  `# _/ U! y7 c* X
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
5 Q8 n/ F, X: I" E$ jcross_marquee.style.left=marqueewidth+8
8 g# b7 g, `- ]  k, I5 X: A' J2 ]cross_marquee.innerHTML=marqueecontent' j, J; [+ X: \4 H1 R1 h  P
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth" g0 H! i8 H! X  a% Q
}
7 L! D1 U% |- P, velse if (document.layers){
+ Z/ F4 p. a5 h1 V2 h! ^ns_marquee=document.ns_marquee.document.ns_marquee2
5 Q5 i6 a5 l% Lns_marquee.left=marqueewidth+81 E' [8 `: [) R  ]" ]! P  q
ns_marquee.document.write(marqueecontent)% [- i. @  I, A" ~8 z9 p" P& ?
ns_marquee.document.close()
/ Y7 o5 _& j  h; Z& T. Cactualwidth=ns_marquee.document.width
8 N" Y0 Q6 O. L}8 T, C- D- {( h5 a& a8 {, {
lefttime=setInterval("scrollmarquee()",20)6 z6 \3 x4 i) ?+ }7 `
}
% x: b( y# m: Fwindow.onload=populate# G' H! C+ E0 T9 N' J
# ~6 m8 y9 x; V( K' Q. a  ]% u
function scrollmarquee(){9 \. p6 j. q, {! M2 J. M6 X
if (iedom){# Y2 i7 d% Q7 \8 X
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))7 j0 e" x, f' |% Z9 E
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed$ l6 k1 g. N2 t1 Z  z
else
+ S, k# j0 V% R9 Z7 bcross_marquee.style.left=marqueewidth+8
) I" m1 g3 [6 T% x! R
8 x% `: [' j% d/ E  q8 ?4 y6 I}8 P/ d3 \1 z! r* D3 O
else if (document.layers){
7 F. K! r7 M' t) Z6 e0 y+ Bif (ns_marquee.left>(actualwidth*(-1)+8))8 J2 ^) w( B, m# k
ns_marquee.left-=copyspeed, ]- v' t! ?% P6 X
else! k) ]$ w& r' ?' b/ ]3 [6 j% b
ns_marquee.left=marqueewidth+8+ q3 ^( A4 s: i# }4 u
}
1 X9 e, {& K; F# D  J$ \6 H( n}: U& d- h6 X" b# ]( `: B
- G  X% P4 q$ j
if (iedom||document.layers){  Q, _0 K& C3 d& V
with (document){
& N- r5 E. G, m) R0 b6 E8 p- Udocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')/ W2 C9 A) |4 m5 X2 u& }, m9 |
if (iedom){* Q. y5 K* L9 m0 v3 e1 G# E" g: w5 m1 e
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')/ M3 k6 J& z8 s' b* o8 R3 k
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
( |5 \7 g/ J. o; I- Ywrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')0 d9 P2 ~/ Z1 w+ K) Z; A: `5 }
write('</div>')& s, \3 R* A9 b
}
( J% L/ E2 ^. ]+ `8 D1 m  g0 `else if (document.layers){# B4 a- Z: q7 ^0 x
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')+ Z2 N/ i$ C5 ]( E! _5 O
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')8 n: F/ B, e6 ?5 ^/ }. E1 Q& ~
write('</ilayer>')
" B  s0 o; L- W; X' O0 d8 C}( I: ]6 S$ T( a; P/ J0 `+ I4 @
document.write('</td></table>')
# [( \5 F! g5 n/ @! z0 i}; A( C2 O' z, [& S7 E# }
}8 |6 h- y& q! S9 M; V; ~  }- g9 a
</script>

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