返回列表 发帖

网页之跑马灯文字特效

//修改宽度7 A+ W% S7 L' P7 E
var marqueewidth=300
. U3 k7 K$ G( O$ q5 U! m! F//高度* Y# j; `# q' O  z& H$ ?' u* K
var marqueeheight=25) x& U# O% u# ~# |( Q# {
//速度(1-10)$ O7 u9 S" n) B8 l
var marqueespeed=3
) J; M3 t4 D5 L% ^% _//背景颜色
/ x  j4 z, j2 Y1 k4 k, Hvar marqueebgcolor="#FFFFFF": p# L" T# q$ v
//是否能暂停 (0=no. 1=yes)?
0 n7 I4 N3 i+ _2 G" pvar pauseit=1
9 f  _4 h& K  G) H" h( ?7 {3 f3 |1 X! ]% D; n# Q" D1 c' u7 e: z! H
//修改显示内容
2 s- I; W1 s4 P4 X$ R7 Bvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'7 K# V! m" U& T9 |

+ d3 U' ^8 _0 U: U( [2 [
( F8 A" P; ^5 q4 G////下面不需改变////////////
. e( M4 f0 Z7 `' c( ]% u7 B7 i/ n5 l, I
- c+ l, A. u- _! c! Pvar copyspeed=marqueespeed* {5 K* R! _6 S/ J+ r( D/ G
var pausespeed=(pauseit==0)? copyspeed: 0: D1 e" S# i$ h
var iedom=document.all||document.getElementById
8 S2 j; X; O9 hif (iedom)& x$ o; h( t# r4 h# ~
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
$ k* z+ t1 \  r& Dvar actualwidth=''
) G2 W/ b# P$ g7 O; @- {% vvar cross_marquee, ns_marquee
! a3 `  E( D- i  e% R" g& d# h+ e" ~1 K. o1 ~
function populate(){; Y  n  x7 |( Q& W6 ?% [' k1 t
if (iedom){
# A# F* F4 s/ ^+ g) |cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
. t: g  q& F3 _9 w- f9 Mcross_marquee.style.left=marqueewidth+8/ x7 D9 T/ h7 U. T1 l. n
cross_marquee.innerHTML=marqueecontent) W3 p5 Y5 n$ i% f) U
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
' C8 n0 v, L: Z! F: P) u}
' `3 l2 ~9 |, u6 Yelse if (document.layers){# A' ]1 R* _1 _5 E- X& k
ns_marquee=document.ns_marquee.document.ns_marquee2
: |6 _% C6 {- Q$ e3 U; R5 gns_marquee.left=marqueewidth+8
' d. G& \1 e1 k* X* Hns_marquee.document.write(marqueecontent)
: A) e6 N# x4 D; h( M# N' f6 Qns_marquee.document.close()
. A/ H$ ]5 Z/ ^7 f, dactualwidth=ns_marquee.document.width5 s3 I' o0 f. Q
}
9 t2 B2 |, h! C8 g: W9 elefttime=setInterval("scrollmarquee()",20)% k( c9 l1 a2 p1 D
}
' b% W) H) `, S4 N3 o5 U2 awindow.onload=populate
9 _$ ?6 v4 O* K( T0 _6 a) b# O3 l+ u3 X* {
function scrollmarquee(){) q7 Q$ @1 J2 |% W8 I+ i( G% x
if (iedom){, @+ K- h* U6 G# F) Y1 P
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))( L3 J, l2 X5 O
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
3 h  x( u6 e# r9 R6 u9 E) Telse; p# P8 v: N5 A; I" e& R: k
cross_marquee.style.left=marqueewidth+8
) \6 l8 W2 V/ m
  A- i5 N0 K1 ^- r3 K/ V$ h}
6 p) B* @) ?. y& Telse if (document.layers){  X! M( z' ^, O
if (ns_marquee.left>(actualwidth*(-1)+8))
8 H! F1 K4 ]8 B! }ns_marquee.left-=copyspeed: g; T, q7 G6 x0 V( Q
else
! K* e8 {# @: W4 \( {ns_marquee.left=marqueewidth+8
; Q5 T) j$ @0 m: O2 y}: q& y. M$ s% D2 f# M- f$ g+ B
}
8 g+ M: s  O2 U  Q* l+ v1 W$ W* z
/ Y$ ^  V* m8 i. Iif (iedom||document.layers){
& Z! v/ F, ^* Z1 o' C7 @' ^) Vwith (document){
6 h) }; B6 l, M6 r* _5 M/ }: Adocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')" @& m) A# M- G6 ?
if (iedom){
: F- b$ r0 F! H6 z6 I: \6 Y! pwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
1 ]: [1 G0 f+ l, ]" j3 b# _write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')$ L1 j% q6 F$ c) F; c9 L$ X
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')5 R1 Y7 J6 d: `% |, p/ v( e
write('</div>')
6 x& r0 y* k5 b$ d& h9 y' C) [  U}- u  h& i! W0 y8 l& P( J, B1 h
else if (document.layers){* |% D  p6 r3 \) J* y" {1 k( {5 K
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
; J# `0 }( a) A* _9 Kwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')$ b0 a  i9 S. X" \0 m3 [5 K; Z
write('</ilayer>')
3 _5 Q6 c( O1 j+ ]+ u9 T}1 q9 V, F2 `* M( {9 D' l) ^
document.write('</td></table>'); I- y& P; {4 e
}
' P: E  b( D, W5 Y}  X4 Z# ]  C, f6 y
</script>

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