返回列表 发帖

网页之跑马灯文字特效

//修改宽度
8 S# b" b5 A/ D, C  [var marqueewidth=300
1 j0 n$ B7 R* L) W6 ?3 n//高度
' J! t* m) h  C/ nvar marqueeheight=25# _2 r- x1 S& I# i
//速度(1-10)5 M, i0 i! T2 Z' g" v! _
var marqueespeed=3
4 J) R  n( ~: W4 B% z7 S//背景颜色
9 V3 U6 k, B. ?% h+ Ovar marqueebgcolor="#FFFFFF"
* h& W. I5 N! ^& d1 a//是否能暂停 (0=no. 1=yes)?: Z3 R8 ]' }1 |# z3 d3 n- ]
var pauseit=1' |7 f5 Z& {3 w/ |0 `) o9 C0 ?
" r6 b1 n) ^* U
//修改显示内容& V3 S: I5 i1 N/ G9 z' v  k
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'  c3 f- o) P* i0 X; f

3 o0 g) \  }9 s% R4 C) g) g0 F1 f9 v# h' ?! Q
////下面不需改变////////////
' `3 `: ~& c7 E: |, [  u# X  m& `& G7 {* Q; N* j. g8 ^7 _) t
var copyspeed=marqueespeed/ q- I1 f8 ~( p, d7 f
var pausespeed=(pauseit==0)? copyspeed: 0
- g7 L  Y$ j% A0 K3 M  `  `var iedom=document.all||document.getElementById+ |% ?8 v; f* m5 c5 g, T9 X  Y- q
if (iedom)
8 g+ ~# s$ k. h% i0 Pdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
; v% b( c; {7 L: ?3 A& |  F, @var actualwidth=''
+ r" x$ R% L7 y1 n. k. q. Z& xvar cross_marquee, ns_marquee
1 D' P9 ~% ^6 L# z' }0 Z, s5 Y7 H
4 r9 U  I: M0 ?5 M; d, Nfunction populate(){
/ q; Q$ v4 T8 ]# Q- w5 p1 |if (iedom){
5 n3 A) @, t8 a" }, X' N9 Qcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee/ r+ r& c) {4 S) F: B
cross_marquee.style.left=marqueewidth+8, Q* [! Z4 Z5 u7 b+ s
cross_marquee.innerHTML=marqueecontent# ?+ o! t2 }: H
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth+ L0 ^+ N" v  B4 C" X
}: t; A' |$ @. H! I7 d; r; z
else if (document.layers){
6 d/ W! B+ J/ r5 o+ @ns_marquee=document.ns_marquee.document.ns_marquee2/ P% e. k7 v3 o/ o# T2 y/ x
ns_marquee.left=marqueewidth+8
% j. f9 U  [& J1 H: A% ons_marquee.document.write(marqueecontent)
. V) Q' H6 c: L8 l* dns_marquee.document.close()
& b  j# n0 d3 y) Pactualwidth=ns_marquee.document.width
- h3 }) Y5 o3 G8 t" u" I/ q}$ Y' D( V8 w( i# H$ ?  ?: K
lefttime=setInterval("scrollmarquee()",20)( H, n% Y2 ~$ [  w0 F+ L1 E& K
}6 z" K1 w' }. p5 ~! o: F# i
window.onload=populate; @5 h4 t/ L) l$ _2 Y0 H8 {( M
# i- y* u6 w, [  o: r
function scrollmarquee(){! ]' S4 n, ]+ S2 U4 C3 Q# A
if (iedom){
1 h. Y: e7 r% h( D9 i2 g/ f' ]if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))- M) f4 u2 n) Q- t
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed& h/ `& b2 {) _2 E4 p+ `
else" Z. V2 ?# L! G9 s
cross_marquee.style.left=marqueewidth+8
0 R1 S% O6 v2 g7 e& g, K+ B
! F! F! e1 a& W6 F}
  t; v: p2 f3 [9 Q# _7 D/ h0 d/ p1 d. Zelse if (document.layers){
1 d9 \; K1 r% K! I4 R& iif (ns_marquee.left>(actualwidth*(-1)+8)). [  h  k! Y4 R2 i# G/ |" m% m
ns_marquee.left-=copyspeed
( N' j6 Q0 J- R  \' Delse) o" s5 D9 b  G
ns_marquee.left=marqueewidth+8
5 {7 `4 T7 D0 O}
2 P6 a" ~, c& _9 K$ A$ j}$ C. V8 j/ B. w( d

' b, d8 V. ?. c7 \, oif (iedom||document.layers){" m4 u8 Q, ]# M: r
with (document){! z8 m8 j/ h8 @+ z; @; R
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')1 m% \' w) M+ w/ s
if (iedom){
+ e3 x  _1 d' ?6 C' S( M' swrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')/ i9 l) Q+ W# h3 T5 G: L- \
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')/ c" r! I7 ^% \; O, Z
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
- d9 c% d7 f# L& w5 s5 L$ ?- kwrite('</div>')- `/ z5 ~8 k/ M6 w% f
}
5 k  B3 H% b' Z8 f' R, yelse if (document.layers){, ^+ o  v- {/ w3 c9 \, \/ T& H) R
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
  v6 u/ [6 f" Z% C% C1 S5 d$ ]write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')/ w) P" R$ b" y" O
write('</ilayer>')
, q# B9 e* U( P% B}7 p* H9 z2 M. X% p# }
document.write('</td></table>')
# V7 e9 b8 h4 C  P1 h9 Y1 H0 T+ o}
& A& I5 S! e9 B' z( Z) @# i}6 N2 x: k. u0 E% R
</script>

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