返回列表 发帖

网页之跑马灯文字特效

//修改宽度6 ?6 Q+ s* v4 `
var marqueewidth=300
  o/ T9 i/ |: o' u7 y  C//高度; [+ q- O. ~; H
var marqueeheight=25! `4 d9 L4 w4 Q$ X; N& Z4 v4 C" A
//速度(1-10): m8 v, ]+ }! L0 ^+ u" z
var marqueespeed=37 [  ?: ~' p2 j! o# R/ }" ?
//背景颜色% k  Y9 L) {' @/ Q3 l0 U: D9 Y
var marqueebgcolor="#FFFFFF"* b4 l: {/ n' m
//是否能暂停 (0=no. 1=yes)?& R6 _& k+ `) C# y0 ?1 Y
var pauseit=1& B+ V' w5 K5 e; i2 P' S
/ E' e& B6 i! I$ c5 I: g- y
//修改显示内容
+ b0 z+ d3 S' b8 {& @, J8 |var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'0 d- n: {& N7 |- S- s
& w; u" a# Y# u& t
+ z* v, r$ f  c+ H' K: `, m
////下面不需改变////////////$ ?. B- T# n% z
1 w* }; h- @+ ^! b6 N+ m
var copyspeed=marqueespeed
3 j3 c3 y( ~2 Z0 _5 ovar pausespeed=(pauseit==0)? copyspeed: 0% Z. B( |2 {  F' g* X
var iedom=document.all||document.getElementById, J* w& \7 t  p. m8 ?) _! Q. E
if (iedom)
4 m) p( d9 Y! C! a& V1 P6 qdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
4 g7 @  y, n' A0 Z& w8 _3 R$ t* Xvar actualwidth=''
9 h% B2 y- S9 @4 t) Z# t) z) hvar cross_marquee, ns_marquee
; G; i2 A1 G+ V, o+ K
3 r& y: f$ J" E. w$ L9 Ofunction populate(){
. L3 a, }0 y8 Qif (iedom){
4 R+ l5 J) u9 O7 m- [" M  H0 ^/ zcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee1 p: S8 l: s5 l1 o
cross_marquee.style.left=marqueewidth+8
6 m5 E* t8 N! w, C0 J) jcross_marquee.innerHTML=marqueecontent
9 H/ B5 A2 {- G3 b) L7 Yactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth4 L- Q( ?, ^$ V1 ^8 Z6 |* I$ C& v+ |
}9 a' G3 k) c4 P  E
else if (document.layers){% }3 T4 Y8 O1 W4 G
ns_marquee=document.ns_marquee.document.ns_marquee2
9 H+ s1 Y' i  W7 Q4 `ns_marquee.left=marqueewidth+86 a: Z) l0 n" }* i7 ^
ns_marquee.document.write(marqueecontent)
; s) [7 c3 {& `2 h/ [& fns_marquee.document.close()$ ~0 ]+ O: m+ v# c* A% S2 G
actualwidth=ns_marquee.document.width) f$ s; O. }1 D) w2 N6 @
}( D- O$ [2 K1 a; F( O
lefttime=setInterval("scrollmarquee()",20)& X% J' V1 p% V' e6 Q* b
}4 t  ]# O' G0 E  v! ]. ~3 H
window.onload=populate
1 Z/ ]4 Q: Y( B5 d2 Z* Y# r, J/ E* A, ~" X' ^$ I' |+ f6 P# ]
function scrollmarquee(){
" o+ t8 S: F6 Z/ E2 s7 ~if (iedom){. H. _+ P. t- C/ d3 V
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))# B1 P% N, F3 A9 U: f( q) d" O
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed0 m* {' E/ e; F) z1 \0 Y9 O8 G* z) R
else
: I9 a+ F% c/ a/ F) g+ Dcross_marquee.style.left=marqueewidth+8
- I5 W/ h) A8 l0 f" Z6 V  c2 N# c$ Y" z- n0 Q; P" v4 E7 l3 y) G
}
6 p! t6 r" t" P  h5 |. B% t+ @else if (document.layers){, ^) W8 ?  f) I# {  @% I* Q0 y, L, E
if (ns_marquee.left>(actualwidth*(-1)+8))) X' K( D: `6 n- a  a+ D( V
ns_marquee.left-=copyspeed
9 y7 i5 b2 p& l2 z' {- M0 X, Eelse
" c( }/ ^% N) L8 O& S& Kns_marquee.left=marqueewidth+8
, A7 @3 l$ K3 C( v: Y( P# l}5 ?. V! U+ x) J: g1 d9 y3 u. D5 N& U* x
}* v: E4 A% J# {3 U& D
. e! q1 v/ F( r7 z- N: i2 v; F$ D
if (iedom||document.layers){* }! A$ \6 j6 _, V
with (document){
. [  N$ q' D* y" _! K/ |/ Udocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')+ B0 m. |9 n, r/ L6 `9 J9 H
if (iedom){, e3 t# Q8 i1 ~0 `" f
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
/ g7 @& A+ C4 m) Twrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
& m% A* g: W5 f$ I4 Twrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
2 E7 ^% {* ]  P+ M& v4 p% U; O5 Ywrite('</div>')
6 e3 _& V8 e$ r}; o; h" m7 b% x' C( D# z
else if (document.layers){
& n) m/ t* G* I$ Q- fwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')' k) J, p6 V3 G
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')" ~- }  a+ f0 {- ]2 N
write('</ilayer>'). N1 p- ?7 K$ W" u" C
}
1 W' Z4 Z6 R" |% B% \document.write('</td></table>')9 m7 e5 W# S; U% i: }. C/ ]
}
; Y: c4 V1 k" L! X. a" G; o5 g' n$ u! l}5 r6 M' H+ ]5 A5 T
</script>

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