返回列表 发帖

网页之跑马灯文字特效

//修改宽度7 A  ?- N( E: v: o* _
var marqueewidth=300# ^; R( B7 Z6 `
//高度: I8 K# r; U0 M( d# `
var marqueeheight=25
3 k+ b  e3 j, k2 Y9 N. L//速度(1-10)
9 N# L5 |4 j- j! a& B7 b; N. g* |* Nvar marqueespeed=33 |5 ]$ L1 S7 c, t% e9 i) [. G, E
//背景颜色# a2 N; G1 g4 H5 B/ }
var marqueebgcolor="#FFFFFF"/ Y) o" _  S8 @5 A0 n, r
//是否能暂停 (0=no. 1=yes)?! o3 o- B7 g, @
var pauseit=1# k. U! ?- g. W5 G# X) _
  P5 F1 ?  o/ d* K8 \; z3 c
//修改显示内容
$ l3 ]6 c8 t9 L* |  z( |5 Kvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
, V! v" N* J$ h5 w3 ~0 \# K, E% i! @6 i
* g6 X2 X# t, X- x; M
////下面不需改变////////////
5 ~- W( }8 Y) o1 z' c+ H& `8 c  z- n+ M( ~, x4 o+ d
var copyspeed=marqueespeed$ p" q( _; k( x3 G; A
var pausespeed=(pauseit==0)? copyspeed: 0
3 l7 n# a- q; J. _+ |5 b0 W+ ivar iedom=document.all||document.getElementById" d3 ?- b! U- L+ |7 j
if (iedom)$ H9 c2 l" `% u2 |- s0 o
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')- Y1 \" [, j' R+ n: @
var actualwidth=''% n# V$ D& Z& d+ S1 Q0 Y( V
var cross_marquee, ns_marquee
# E2 Q0 o' R( n6 p  {; T+ A
: ?- q+ O) d7 E  ffunction populate(){
% W1 e0 a1 J1 H) x, b/ C+ dif (iedom){, A5 w; p4 U5 G2 Z# y% \+ {
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
5 B: ^2 t% A. K, |) s! T! dcross_marquee.style.left=marqueewidth+8
# d5 [( X8 G8 _, R9 Pcross_marquee.innerHTML=marqueecontent
. }* T1 x, M2 D, ~/ O' t6 `actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth+ `/ S( r3 K. U' D7 R' V" L7 p
}! [! g+ ?8 A5 t) r
else if (document.layers){
5 E' A5 ?+ L" K6 F% ]8 Q, Vns_marquee=document.ns_marquee.document.ns_marquee2
) }+ ^, h3 u3 {0 k1 |2 L) B1 c) Tns_marquee.left=marqueewidth+80 |4 Z% I' |# t+ s, Z. x( I9 N1 j
ns_marquee.document.write(marqueecontent)  Q# [9 I; R5 T
ns_marquee.document.close()
* m0 Q2 V6 U6 z/ o2 _0 K2 v( Qactualwidth=ns_marquee.document.width
) S. i' [- K! y0 l1 H! e}
0 J4 _( d" i: j& W+ Hlefttime=setInterval("scrollmarquee()",20)' I/ g' c: Q5 E; L" B
}& `, J4 _7 }! K* \+ k) |- b
window.onload=populate) s* n* M# R3 O. z3 e. s: O3 H3 X* p

: p3 \1 h4 ^" C  j1 |4 i* _& T$ Cfunction scrollmarquee(){1 [7 k* [8 X) n
if (iedom){$ ?0 L2 K! U: R7 b  v! x' W, w+ E
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
, l& z+ h5 l, x: Z- d0 F  scross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed: H3 S7 ?: X+ d( H6 h5 n
else; i4 i# J( w% {  C! |
cross_marquee.style.left=marqueewidth+8
$ H3 r5 }; k9 [) z+ d
3 h: Q- `' z- @* z" u' D* Y; v9 F}* R0 v- N- F" B( ^* f4 G" o- ^; ?8 [
else if (document.layers){
/ S( H- }+ r+ a, d- s. m* v9 Hif (ns_marquee.left>(actualwidth*(-1)+8))
: Q5 y% \+ h6 p/ o& dns_marquee.left-=copyspeed
$ o, j. r1 X2 h: I! jelse- k$ I, _8 n9 d# j
ns_marquee.left=marqueewidth+8  M. S7 M5 {) u* {7 D! o" u0 i
}5 A1 E8 V- R1 E- J
}
( ^5 `* f, Q! ]7 [- }3 M
. e6 c9 g* O8 ^+ iif (iedom||document.layers){
8 L. J# W3 t: ^5 M% y9 P6 D& w$ C" Iwith (document){
6 g) p4 M. d( X# `1 E! c: P$ S+ Ydocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
. P. f! V) Z' z6 |6 fif (iedom){9 j! a/ m! y  L  P/ r4 D) u" }, F
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
6 o/ v( ?4 ?0 rwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
1 E' z# F5 f0 V  i" pwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')2 p4 ]6 z) i" a( z
write('</div>'). v  @: p  W1 |5 ]
}; ^) s+ a& [, b) l% w
else if (document.layers){  [. R& G+ D4 ~4 i$ v" H  k8 t
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
' d4 N2 V, C+ ?! |1 \+ Ewrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')- t/ i  |. a5 d$ |% C8 {+ p, v3 X8 Q$ ]
write('</ilayer>')3 g+ y/ U/ z, u0 O; e  Z" l0 w& G
}: q! d7 f0 ~4 \* C5 B# d; e
document.write('</td></table>')/ m! ]3 E3 s% c
}
4 E& h2 {' i2 M7 E: M6 [}- O6 h1 e  N5 J4 Y8 N8 f
</script>

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