返回列表 发帖

网页之跑马灯文字特效

//修改宽度
& j$ G7 d3 L& [. C3 _var marqueewidth=300
+ ^5 L$ m$ \* D% r% m1 v5 Z, J2 x5 x//高度
  o4 F; I$ z- T9 t) I0 H3 t5 jvar marqueeheight=25
& B2 ~( J8 h$ E( J" Q/ S( d! X, E) S/ N//速度(1-10)  Z# M" E# [- l) f8 v
var marqueespeed=3% e$ K5 I: I/ z/ K
//背景颜色: E! c9 w; @* D- w% i2 P2 m6 F2 x
var marqueebgcolor="#FFFFFF") l% L# B& q$ @; B
//是否能暂停 (0=no. 1=yes)?; Z+ o" \: @' K, s0 t$ H! y
var pauseit=1& e6 U. A8 R, N6 C+ ?; |

  A  D" o& F8 Z9 |3 e* E' f; |//修改显示内容+ V, A8 O! }9 w
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
/ f+ _) p7 Z8 j  ^4 T3 f5 @7 r3 x1 @) w5 I5 g  N
7 t; c% S  \! E9 A; k
////下面不需改变////////////
- |, {! g' M; a: E# ?% c$ M6 d( D
) Y1 K; X  G) t1 p( G: Qvar copyspeed=marqueespeed3 I0 ~8 G2 u9 Y4 D. z" b
var pausespeed=(pauseit==0)? copyspeed: 0
6 p2 p: Q3 D5 Z' R6 bvar iedom=document.all||document.getElementById) G7 S8 _5 r( C& S& j6 P5 {  `
if (iedom)1 C* Q+ d$ c% d$ n$ _* O0 J
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
2 t) H9 B4 `- y: R- jvar actualwidth=''
' `6 V1 `2 B( l! |" O# p/ kvar cross_marquee, ns_marquee
) k7 D! P2 ?+ Y; i# W" h, p9 a" p; o1 k, J) ?  j8 D
function populate(){, w3 J3 {  d  l0 H+ ?' M
if (iedom){
/ I$ o8 h# M0 ?& xcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee, o% V* i7 X, ~
cross_marquee.style.left=marqueewidth+8
; |& z* T8 t* s# k% H8 x4 C0 rcross_marquee.innerHTML=marqueecontent
: `2 }  b' }6 r4 A% Uactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth3 E; o6 y, m8 h
}
; L6 D3 \5 A8 Y0 Q( N4 H+ R# c/ helse if (document.layers){& [7 I. m4 Q6 X( a  A7 g' ^! i
ns_marquee=document.ns_marquee.document.ns_marquee2
: a2 H& w: x- \$ z- r" Wns_marquee.left=marqueewidth+8
& v6 y( b5 @4 f* `0 J8 e$ Sns_marquee.document.write(marqueecontent)7 T) d9 {+ B, F
ns_marquee.document.close(), ]' F' O9 f9 b3 U3 k
actualwidth=ns_marquee.document.width" Y6 E$ d1 P2 [, f! g' ^
}
/ C! m$ L5 k( D. J6 F+ T0 ilefttime=setInterval("scrollmarquee()",20)0 {9 f4 E( O) s( [' d: y0 n# d
}6 Z( q0 _/ ^; E0 P! e
window.onload=populate
! m  B2 j8 k2 x- n. E* C
8 `- @8 ?) A4 \! F9 Gfunction scrollmarquee(){
, N7 z/ H) Z% Yif (iedom){; x( K0 C3 |1 Q8 n5 j4 ?6 v  d
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
4 I, r- K* _& Ycross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed9 W" d% q$ e( Z" P( C* G/ ?
else+ n' t! Y) q  B5 k
cross_marquee.style.left=marqueewidth+8- ^. P- J% H+ f" C2 s1 ?) w9 w* @

' O; a: D* C! H$ _5 l% G  O' i- U}8 G5 b! P% E/ a9 Q. q& S" @  |
else if (document.layers){% R+ F7 l! v! }+ p4 J+ x
if (ns_marquee.left>(actualwidth*(-1)+8))
" F7 L$ e4 q. E. ?3 l. ?ns_marquee.left-=copyspeed
. d3 Q; Y6 G* r5 k/ s6 H; o/ k; Jelse. \' D5 w8 R! V4 [$ _
ns_marquee.left=marqueewidth+8/ r7 L) p( V8 z% i7 R, Z" ~
}
1 K+ ^' T6 g7 R0 E4 o% I, H: Y}
4 [0 W  u4 R' ]( [6 I3 l. ?; i, ?$ ?
if (iedom||document.layers){+ o; {$ t8 H* T/ Y  G0 S
with (document){
3 G- f4 O& f2 ~5 Sdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')5 D1 L2 Y7 c4 r3 S
if (iedom){
% s. O+ i' K+ Q- a, K: [& ]; ^write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
$ _' T2 Y+ t+ j1 dwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
4 i# @. R# {( Y* k: G3 Rwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
9 h/ v' M# [, c! I% |# W4 awrite('</div>')
, g( J+ ~5 u/ H  S  ]' H}0 O. z- r- P( L# x! H
else if (document.layers){/ o6 v  [9 D3 @; L9 h
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
& Z- f( [' x( w6 D) ~! `% l2 hwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
# c9 q, q4 `3 `# M0 vwrite('</ilayer>')+ R4 i* Z8 ]% g  S1 s
}2 j! y4 S2 A3 Q* j2 h
document.write('</td></table>')/ ^; D  f1 A8 X& e! V
}
; Q- v5 Y3 ^; m! U% b}
; O2 `* f  |9 m</script>

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