返回列表 发帖

网页之跑马灯文字特效

//修改宽度
2 f: j& {9 c- E3 svar marqueewidth=300" W- h$ v6 [5 ~
//高度, m: N( W! h& ^+ Q$ a7 h- |
var marqueeheight=25
# E  _" `! M, S! w//速度(1-10)
! ?9 G  d2 r, P' n  Z! h2 T* y. hvar marqueespeed=30 C& {9 i5 X* M& f5 j8 s
//背景颜色- T* l1 ?. n, `3 b' f3 F$ x7 D
var marqueebgcolor="#FFFFFF"
3 |- J) ~0 U2 f  O. j+ E//是否能暂停 (0=no. 1=yes)?6 L) W" g! O3 Q
var pauseit=16 k$ c- c/ `% P  C6 X6 l# v
, i6 Z: W& h9 ^
//修改显示内容
% Q4 F& f3 o2 @2 \8 F& B/ j. ivar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'* z8 n4 h) V: K+ D; M1 k1 L

) y3 }) R2 ]3 m8 b4 A  T7 R( W- }- a3 K$ E# q. Q8 I! `% ?
////下面不需改变////////////
; t: {0 k6 n; q1 t% ]. P( @5 [, e
  u+ v5 n& ]" u8 L( T6 wvar copyspeed=marqueespeed, R% e: L& `! P) a( b% p6 |
var pausespeed=(pauseit==0)? copyspeed: 0$ K! E6 I5 L4 L  o$ [
var iedom=document.all||document.getElementById
: D/ K" e( H+ ~3 \( F2 iif (iedom)6 n+ T- q" D& s& W% }, N' e& D
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')/ g! |. Z# z3 \  z9 n) T( V
var actualwidth=''
/ G; l0 y; u# Gvar cross_marquee, ns_marquee
9 {5 ~4 V4 J. Q' K
. X% x- O, R0 X, A* l4 f' B2 qfunction populate(){5 v& _5 P5 q- p/ m6 d2 `
if (iedom){4 {: C' Z% i2 [- Y
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
2 P8 F+ j; c' {) scross_marquee.style.left=marqueewidth+8" F' q' S  D. S! U8 ?
cross_marquee.innerHTML=marqueecontent
  \+ B9 u; q* U8 u$ a' s# @5 Factualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth& K7 V: S  D6 ~5 c+ }- d8 K  ~
}
+ |0 ^' I8 D8 _! gelse if (document.layers){$ V: Y) y% L5 a. b
ns_marquee=document.ns_marquee.document.ns_marquee2
9 ]4 j6 o* y; t7 k, ]ns_marquee.left=marqueewidth+8
% T: D* q* u; t& B+ p/ o! S5 lns_marquee.document.write(marqueecontent)1 h, D- T/ O, r- p, R
ns_marquee.document.close()$ ]5 t9 A% G2 N; i4 `
actualwidth=ns_marquee.document.width6 ^8 g9 h+ r. z5 ~) z  b
}
+ A: J% c, o3 {! Wlefttime=setInterval("scrollmarquee()",20). M! o2 H0 x; J5 ~& V4 ^. h% |  G
}4 g8 P) {$ y6 S5 K- i
window.onload=populate
: m1 R" L1 a- I2 U' a. D
* Q' C. T6 R# N& {2 X- Kfunction scrollmarquee(){
0 I- f7 S5 e  j8 P# gif (iedom){
; y7 `: L9 J) h8 L2 F3 n3 f- N/ ?if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
, {) r1 |8 w& Z6 }cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
( s. H0 M! L# v! Jelse$ x" o$ l& e7 a4 N0 A& k
cross_marquee.style.left=marqueewidth+8
+ X) U+ g, G5 f# V. Q4 ^
) L0 W" w  T- m, K- d}# K3 e, I, k0 ^
else if (document.layers){
4 i. A) b! ^, D1 Iif (ns_marquee.left>(actualwidth*(-1)+8))
# n/ X0 G# h2 a: E8 K1 s3 }ns_marquee.left-=copyspeed0 j! i. {& t2 p% ~# r% R$ \( p% j8 d
else
2 c$ D' g+ d- Sns_marquee.left=marqueewidth+8- o2 [- S9 d/ U7 u
}$ b% v# r. _' M, o
}/ k9 V! O# a, c  X$ s7 ?# }

. K  _1 }0 N4 g# p. u+ ~if (iedom||document.layers){5 W- d# C- g; A. e6 o, q
with (document){
. h6 {, V2 |+ M( }+ W4 _document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')" Y5 P* |& I$ R2 ^2 E$ V
if (iedom){
+ L/ w' d) D" _& T1 \4 Qwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')- p1 X! ~- p- Y  Y. D
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
, F& E; w7 k: Z. C% O; G- ]write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')1 v$ \# g9 M/ ~0 o5 p, o* c
write('</div>')
, u' n/ M# f3 \. ]}0 W' s- y+ i* Q7 v
else if (document.layers){& \3 \3 a3 u& L% m3 _
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
  f5 E& y0 ~6 c3 b3 W' r  [' Swrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
8 M6 {8 B0 l: ~8 T. D* cwrite('</ilayer>')+ W3 u! `1 t* r1 @' v
}8 V. B5 Z9 Z5 n/ j, _! @- K
document.write('</td></table>')3 s. @# M5 o' \" ?, _4 ]3 D0 Z& p; [& _
}
% K) A" m% h7 M' X) g5 _}( `# _3 n8 l: ?
</script>

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