返回列表 发帖

网页之跑马灯文字特效

//修改宽度3 @! f+ D) t! ^4 f
var marqueewidth=300
6 @( Y( N: Y1 Q) I//高度# r2 l; e2 ^9 w) c
var marqueeheight=25$ n* c! s) v$ V9 R! B, R: e4 O
//速度(1-10)7 i3 f  E$ X# t$ ^' _4 J3 T$ y
var marqueespeed=3
; U( q& B; {- w4 g$ h- W0 C& c: y//背景颜色- }& Q, g; J* R
var marqueebgcolor="#FFFFFF"
0 Q+ C2 J) A, v//是否能暂停 (0=no. 1=yes)?% g( @. }- \" h2 ?4 G
var pauseit=16 T0 i- ?+ X8 y2 K& g
8 I, E0 m! ^5 g
//修改显示内容* K9 |  ]5 \: t+ t: h! z- V  R+ x
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'& b3 l/ R5 n! k4 O" m

- I) y" E" b' c6 S! m
4 O1 A2 V# R- J8 O$ Z////下面不需改变///////////// W2 w! U0 d5 H/ v, [
$ C+ N; K; h. E5 V
var copyspeed=marqueespeed7 Y% y! T" Z8 x& m1 a5 z$ s& v
var pausespeed=(pauseit==0)? copyspeed: 0
. `' p7 f( Z9 G7 a0 c8 [var iedom=document.all||document.getElementById
: B& T: U- g# y) Iif (iedom)  l- k; `! B; {/ i% q" G
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')/ [; \" z4 ]# Q9 H0 V- ~( I5 y
var actualwidth=''
! x) e- ^6 e3 b8 X. q7 F. H: Mvar cross_marquee, ns_marquee
, Z$ }+ o! X! y" a9 m/ h% N8 w- g0 ?+ G1 T) O3 z. }; U
function populate(){
9 d3 M6 K8 }% ~% S$ E' vif (iedom){' G+ Z- U1 m2 m5 ~; M
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
4 Y# [( s4 `: a- @cross_marquee.style.left=marqueewidth+8
& U6 t" G# U) L6 g) _6 y3 gcross_marquee.innerHTML=marqueecontent
& E1 @2 }0 o) f% Aactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
( w/ o. [8 |4 {. v$ |: o% b% }}
! a  s5 i6 C# e: C$ nelse if (document.layers){8 e+ [/ h( V5 `/ T) A
ns_marquee=document.ns_marquee.document.ns_marquee2
: n' [7 ^# J. H) uns_marquee.left=marqueewidth+83 H& n- `% s7 g% o! b# f* A5 t5 l
ns_marquee.document.write(marqueecontent)
: P5 D8 T7 m/ p0 C( Wns_marquee.document.close(); A! e' d4 I3 @  m, ^; M
actualwidth=ns_marquee.document.width& R: Z2 G' x3 q  d8 ]
}
+ [+ i: r9 c! g4 d- y6 V  ]lefttime=setInterval("scrollmarquee()",20)
7 ~* G4 J- ^# X3 N9 \+ o}
2 {# ?/ Z$ H2 J1 l9 Ewindow.onload=populate6 ?1 ?' H  i* w3 S
" T7 k! U! }1 b" W2 t0 B
function scrollmarquee(){- g6 S8 A7 ?; ~" \0 m
if (iedom){
) G1 t) m/ |$ `if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
$ `, P5 h9 Y. xcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed5 B4 y. F5 t& D
else  P. q0 f' s! N! T2 O; ^( |
cross_marquee.style.left=marqueewidth+8
" {- \  }. z) E/ Q  ?' g
0 n3 `* S* Q0 A" f* x( O: C}$ E& |; m1 f3 C& v/ J
else if (document.layers){
# w+ i3 z$ D; Lif (ns_marquee.left>(actualwidth*(-1)+8))
7 x) n  r2 o0 g+ i: u1 G3 Fns_marquee.left-=copyspeed: m' L( @4 R* k$ \% U0 L
else  Y3 v, k5 z& R+ e* U' [9 E
ns_marquee.left=marqueewidth+8
: ]; K, P1 U* s9 a( a& l4 C. ]& {8 I}
! s3 \5 }, k( C: `! ~# A+ y}$ h  k% ^+ ]+ s& _# G, ]

- A, c8 M& Z( v* H0 Bif (iedom||document.layers){
" P" o; N8 V1 ]' e" A4 Owith (document){$ G: R5 }7 s5 v# p! T
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')5 H1 p  u9 k3 s% B, Z
if (iedom){
7 v3 y& B: [1 |* Awrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
: l" v' G% Y( A+ k' iwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
( p1 A0 l6 m  p+ j- q8 Pwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
+ i7 [7 \- n- K$ x5 \$ T0 x# Qwrite('</div>'). m0 m* }$ a2 D- B9 V0 A' X
}9 |% }3 i; C) C! w& e* R, d
else if (document.layers){5 Z& b) W2 P% g, S5 ?
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
; w. ?; K3 B6 S; Ewrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')7 {: A6 m) P; x
write('</ilayer>')
4 N1 V4 F% q4 `+ H8 v}
& s8 m$ A8 U: o  A7 ?document.write('</td></table>')
8 D% W. U$ X+ M+ c}
, q" d, ]9 |- h4 u}5 m( N+ \0 F) I) J4 W
</script>

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