返回列表 发帖

网页之跑马灯文字特效

//修改宽度
3 L# `! t' t. C# ~! J' Uvar marqueewidth=300
3 n+ m5 t/ ^# Z# a8 L) w$ V//高度
0 L3 S3 |2 w/ T6 t1 T3 wvar marqueeheight=25) ~+ x/ Z& B0 W7 T5 T3 L- g( f
//速度(1-10)
+ ]( y: ]: y$ K/ |: hvar marqueespeed=3; G0 E6 B# L, u+ U# i0 e
//背景颜色
0 {4 c. ^# r' `% D4 d& A$ J: Rvar marqueebgcolor="#FFFFFF"7 T8 g% Z+ h2 N
//是否能暂停 (0=no. 1=yes)?
5 ~& K  ?0 _6 B2 S$ ~var pauseit=1
& Z* }4 R8 v0 j8 y
; Y: K# i/ Q! P# F$ ?7 G6 T/ @//修改显示内容
5 O) `" m0 x; R  G7 ~; c5 |; m+ ~! Z" fvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'& [# L& H2 S; j8 V4 n+ w4 w

( y+ j9 }0 K4 ~, @1 o; g0 }, r! l. `0 C8 y
////下面不需改变////////////+ z1 A! @& _/ Q: Q! n
% g! a9 B* i* k  Y. t/ v
var copyspeed=marqueespeed3 q5 C8 W2 ?' d: H% L6 T
var pausespeed=(pauseit==0)? copyspeed: 0
3 H( w+ V6 y' e* i* R$ \( y! T. bvar iedom=document.all||document.getElementById
/ k. N: @, G: S/ s4 Tif (iedom)0 A5 t1 b# B; f' ^. O' y% G  S5 P
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
* d* Q: I$ L' a: @8 K8 yvar actualwidth=''8 Q+ i% |8 P3 u- ~
var cross_marquee, ns_marquee
* Y2 t+ i1 e+ b* u$ g, |; e: G0 I: U3 w+ N8 f, E) a) Q, L+ L& m% V
function populate(){4 j( O8 f4 t% ^
if (iedom){
) }$ o$ x- n# q) f  W' Zcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
, i) z- V5 u) X& Q: ]1 dcross_marquee.style.left=marqueewidth+8
7 @& e# \+ _0 a2 T  ycross_marquee.innerHTML=marqueecontent
! `+ B' C0 U" [3 b' O# S* P( lactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth4 m* A$ T9 P* z2 _0 a6 V
}, x/ Q, y& J3 L- _& f
else if (document.layers){
5 ]. x4 o% o, J" v  C6 M/ xns_marquee=document.ns_marquee.document.ns_marquee2
0 ?, g& B6 T" v/ M) U7 I( jns_marquee.left=marqueewidth+87 u0 f, Z5 X3 D$ a# D
ns_marquee.document.write(marqueecontent)
/ W) {  ?. U4 T2 E' Q2 M8 Ins_marquee.document.close()0 `1 }: T4 Q3 u; {; V8 E
actualwidth=ns_marquee.document.width
, c/ R2 [3 a! W8 n0 ?}
) F' n3 U# v+ H! R7 c# O, Zlefttime=setInterval("scrollmarquee()",20)
# w# Q: k' |' N! U# F}0 E$ x- N8 r0 r+ W- ]
window.onload=populate
8 B" X( M6 K; w' M$ z* @  F9 `! u6 j
function scrollmarquee(){
( ?0 x5 U' f( B1 ?& Rif (iedom){
6 ^- w) \" n& n$ o/ nif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
, Q3 k2 ?2 K4 a3 qcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed; F+ R' r) Z! S4 u
else
! O# I+ M  b. Y2 L1 ycross_marquee.style.left=marqueewidth+81 p7 g$ u  m, n8 O  z1 w
/ t/ H" m5 f& v
}
! H- [: @% ^+ X7 d! m9 Ielse if (document.layers){. ~* b- X8 d8 c/ ?) @
if (ns_marquee.left>(actualwidth*(-1)+8))! ]+ z% q8 H( R. h
ns_marquee.left-=copyspeed
6 u  K1 O) J" Z+ A! belse* ~$ e8 f, v6 Z& O9 k/ G6 B# I
ns_marquee.left=marqueewidth+8$ A' s1 p3 O+ E4 }0 U, r
}
+ U' s: n$ g6 [5 B/ P6 [- F}( Y# i: s6 g/ v: t, P7 x5 H

) e* }$ R# F8 z7 P3 uif (iedom||document.layers){7 u9 z; d* S: n" B
with (document){  r1 {8 ?; l/ z5 ?; q; A
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'): |, {9 H- }1 G# x
if (iedom){
- y, c+ x9 G+ F' |" xwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'), {1 L# v1 R2 p7 z& a! e1 \' S
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'), ^: s$ Q4 [: B: k
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')/ g1 u% l6 b4 H0 m, f% k
write('</div>'): H- y$ C$ V7 f# |+ e6 N
}& H- C! }) s9 X8 \2 |& Y
else if (document.layers){# H- X& x4 L8 V+ n
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
% G1 y( g6 @* a2 I2 Y2 fwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
6 D* g( ]: C. T: `4 Y, u0 ^write('</ilayer>')
  a' \& k/ U" c2 A0 \}; s2 x8 b+ a8 @" l+ x
document.write('</td></table>')
2 V" `0 ?  O2 X9 y2 z+ g% ~5 n, ^}+ @2 N7 y* `& G6 ^$ T0 M8 u6 W
}- o, T* l# ^) B  R
</script>

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