返回列表 发帖

网页之跑马灯文字特效

//修改宽度
" w% E7 }* l9 D- E! Y/ Ivar marqueewidth=300( `7 B" L' W+ M+ i; ]
//高度# Z. }( I- l% f" H& D3 ?, E0 d. e* m
var marqueeheight=25% @& W/ c. P& A) s. w
//速度(1-10)# |5 Q6 Z7 H4 \8 a9 @# W" Q- B
var marqueespeed=3
9 t5 @. Z8 V! C! W: l//背景颜色
- j0 D" Y- F5 Q/ Kvar marqueebgcolor="#FFFFFF"
# |. T# g, G0 w. q, I- p//是否能暂停 (0=no. 1=yes)?  i/ ?5 {4 f5 i! M) Y7 R
var pauseit=15 K+ @7 Y1 c6 }) b
0 h) R9 M) |4 F7 y4 G
//修改显示内容
0 R  y- x- z' c$ Avar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
" c4 {9 j/ y& S3 V0 m9 c$ B4 O6 r- p6 x# J, o2 Z0 T

% b* N. p9 r( \% m' l////下面不需改变////////////+ ^0 w9 C+ {9 ], W2 [: _
, }2 V0 e$ H  m* V1 W
var copyspeed=marqueespeed
: _  ]- Y! i6 hvar pausespeed=(pauseit==0)? copyspeed: 0
6 U) R. ?  @4 |6 R( }2 d% Wvar iedom=document.all||document.getElementById
* `3 [: p4 @5 L0 Cif (iedom)* I" L2 @3 g, J  D0 v, n: w8 q9 e
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')3 w* ^7 o" h4 ?
var actualwidth=''
: i1 C/ K0 d2 m+ Nvar cross_marquee, ns_marquee
. o* S3 P$ M! \8 a- W  t* |/ L8 w9 ]
function populate(){
7 B3 W) a4 W; i+ Jif (iedom){
& i7 F  C- c. k! `& g% ?cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee: Z* n6 E) r3 R# A) q$ Z& U8 ^
cross_marquee.style.left=marqueewidth+8: F3 S9 t3 q" [# _
cross_marquee.innerHTML=marqueecontent% d9 c4 a3 V, G; `8 e5 v
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
$ n* R9 K6 Y- w& i- C* k5 p}
& U; D9 a3 m$ L6 h, V& g; w" belse if (document.layers){
- [: }. x+ G6 ]6 V) ~9 H2 y3 Tns_marquee=document.ns_marquee.document.ns_marquee2: X' r) ~; B; e- ]1 `1 n9 `5 b
ns_marquee.left=marqueewidth+8# a: R- l9 V7 W1 V* F  v
ns_marquee.document.write(marqueecontent)  t+ q5 o; H: C: }2 e6 E/ J* N2 C
ns_marquee.document.close()
/ p* E) R' Y* z  ?( s8 Mactualwidth=ns_marquee.document.width8 v: U% N* q, R; e; U
}- X3 D% }' f- _" W
lefttime=setInterval("scrollmarquee()",20)
2 s+ _) f  x$ b: e0 i1 q}
4 o# \( O' O# ^6 kwindow.onload=populate
/ f: e7 E3 y3 q) {, |5 X3 E
8 n# p% O4 z8 |/ I# afunction scrollmarquee(){
2 W+ C) y& @& Q) m/ [8 R# E3 Bif (iedom){  J9 {; O( H4 A* P( a
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))# c4 F  f: g! c# f5 t( k
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed, s9 Z' Q6 L6 O0 s7 W3 J
else
; ]( g  O) q! P: c2 mcross_marquee.style.left=marqueewidth+8
' L* X# P8 L6 v) v3 N0 t( h  b" K9 h& C2 W3 M8 x' j
}* S0 Z& j) Z8 i! F5 ~
else if (document.layers){
- S& I: N) X* o" f$ ^% jif (ns_marquee.left>(actualwidth*(-1)+8))
: e+ F/ V+ @% _  C% W2 A# k/ h6 qns_marquee.left-=copyspeed
: s9 E5 ^* h3 A3 A3 |% lelse
3 S, p4 C! f/ m. ?! ?( p3 bns_marquee.left=marqueewidth+8- |  \7 `3 q) g4 D4 m! v8 t
}
" I& N0 f1 m) F" p- A2 E}3 ^2 I: X% t7 ^# _% @  b' v
( y; Z) `2 D/ Z' Z! J1 o& i
if (iedom||document.layers){7 c) n- P! i% G; P
with (document){
$ V8 S! a# h' s4 T! Hdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')& i; E$ }2 c# n0 D5 ?) i
if (iedom){
0 O3 B3 W' G! l1 c- C, b4 e# Swrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
& D  e( Y- D" g7 ]6 Xwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
1 Z! P0 `6 \- g! Uwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
; G0 o0 M+ |6 H  qwrite('</div>')9 w1 e: V& V) A, \1 h3 M4 a2 K/ p
}
) M! ?4 H/ S1 O7 k- E* `else if (document.layers){7 g1 t0 B; B" i1 w
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')# W# x0 A; s" d2 b4 i
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
! r3 {8 M5 G/ U+ c/ `2 v5 a- F9 h! bwrite('</ilayer>')0 |; r3 `5 O8 P* d  q$ _! n$ ~7 ]) v
}# L6 G- ~( d8 n2 D* U+ R" `5 A* }6 V
document.write('</td></table>')
8 b" G+ j' h2 q3 _/ D: X) p}8 Z8 l# ~/ o# W! ?
}+ n! Z0 }" v- I
</script>

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