返回列表 发帖

网页之跑马灯文字特效

//修改宽度
/ w# A& @- l9 H3 W8 Lvar marqueewidth=3006 S2 L  j5 h. E; x8 u8 I" N# U/ O
//高度/ ]3 R' k- q. x1 h, D
var marqueeheight=25! l5 M- I* q0 Z$ {2 e' x
//速度(1-10)
$ S  R0 {; x+ }4 Z; i5 @; Kvar marqueespeed=3
. O( \' L% U2 K& q//背景颜色0 J4 y9 y3 \, Y0 q& J; K
var marqueebgcolor="#FFFFFF"
" O6 y4 o4 _) W% p//是否能暂停 (0=no. 1=yes)?
- f: i2 v3 e/ D* N6 i# Uvar pauseit=13 ]3 z. b$ T( h8 L# d

+ R9 P3 ]* B! r2 Z//修改显示内容) I$ o) X0 M/ S3 _/ F
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
% z' u  O6 y6 A* Z2 o1 Q! K5 Z
  {9 G4 l2 R1 a1 X
& M; U- ?: q& [: _' |3 _) a8 g7 ~8 Z////下面不需改变////////////
9 o8 u6 @5 ?) R) Q
! [. A+ A% z" ]9 Ivar copyspeed=marqueespeed. _/ A% u7 _* _( ~7 ?1 Y$ A! G& K3 f
var pausespeed=(pauseit==0)? copyspeed: 0
  v* C7 K9 }$ ~/ d1 ~5 B& hvar iedom=document.all||document.getElementById
. p# O' o/ F) F# M2 |& cif (iedom)( R% w3 C# }3 L: V
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')7 L  R1 z8 R- g' q
var actualwidth=''4 J9 }9 n/ |; m- G4 P" F
var cross_marquee, ns_marquee
( ?4 s1 k  p6 R# ^; O' Q
: H+ [% \% M  F) p# R- d7 gfunction populate(){
2 }, N& l9 u, j" C  ]" y0 qif (iedom){& a! L. o0 j3 d
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee+ ^$ J" j, J& j& }3 v. O
cross_marquee.style.left=marqueewidth+8- ~" B' S; w* i8 [/ }# v; b! _" L
cross_marquee.innerHTML=marqueecontent  D7 D1 t2 _4 c! I% B" v8 F/ N
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth% e) T% s# F: W5 i' v" m
}
: |" l9 T9 R6 ]0 p4 `else if (document.layers){" w$ B8 Y  Y9 e  \
ns_marquee=document.ns_marquee.document.ns_marquee25 M" M8 @6 f/ W. V  w: W
ns_marquee.left=marqueewidth+8% z5 a7 R( H, J4 |8 @
ns_marquee.document.write(marqueecontent)
2 j. ~1 t1 }# {0 T. kns_marquee.document.close()
5 r) o# b/ f7 `) L& lactualwidth=ns_marquee.document.width
2 f! j) o4 Q8 s, f/ A7 t% K}' O& q/ x' ?" `) _
lefttime=setInterval("scrollmarquee()",20); T# X. }6 |( i% e: @) ?) w, p# ?9 V
}$ |0 R; {/ i0 A, {
window.onload=populate/ l  g6 \4 r7 w
: X' f7 p! Y0 ]
function scrollmarquee(){
7 E! p$ ~7 o% P7 Uif (iedom){
& s) a8 B1 l4 tif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
* l. j; W6 g* R5 e9 f. Y: ccross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
7 x1 k: ?$ D6 ~9 Zelse) x# f9 {/ t1 ^4 w5 m) m
cross_marquee.style.left=marqueewidth+8
$ {5 Q* Z/ q* W, f9 z
. S. f2 R  Q; x( D- \}
4 ^6 }& `& k4 y' o. [9 v; L6 P" C7 `else if (document.layers){
4 f6 ?9 F& a) B3 fif (ns_marquee.left>(actualwidth*(-1)+8))8 \' [+ \0 X' B% L" }
ns_marquee.left-=copyspeed" ?* w3 v  w* k2 L7 _( o
else9 E7 }( C' r+ q* l; E$ F, Q- N
ns_marquee.left=marqueewidth+8; J3 w* N% o" G, c$ M5 m7 O
}
* H) o1 z; c6 o}
" o% |& d. `5 ^
7 M& J+ y) ^& ^# Qif (iedom||document.layers){
/ [& l4 X% D, B! Q# |  z0 G) Uwith (document){
% Q# s7 s+ Y0 _0 ^document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
) ]5 B) X& g; ]! k  v0 `if (iedom){& z3 S8 _! V2 K2 L: _5 X: j7 x
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
# k0 D3 j) u6 v( xwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
6 n/ A9 e& n/ O, Wwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')2 D+ j0 h' C6 z, F, K
write('</div>')* x/ f) H3 b, l- q# D9 ~/ x
}& v; z( u$ ]( r# k
else if (document.layers){4 A5 g) ~0 M" I
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
- k& w# P+ x# J1 U8 s5 wwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
% I/ _5 m. r% kwrite('</ilayer>')9 V  f* B& C7 [' d
}6 l: J9 T* [7 O% p& W7 j8 J9 M
document.write('</td></table>')
" N* p8 }5 s# J' E9 Z}8 _8 A. S5 j! o  f
}  e& f" [) Q! K# N& a5 t/ T
</script>

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