返回列表 发帖

网页之跑马灯文字特效

//修改宽度5 u. L- o2 G; t4 h
var marqueewidth=300
  G/ m4 Q; b/ m) z( `0 G- x! K//高度6 a' G! F$ l4 `; |
var marqueeheight=25
' C1 Z- i/ m" c6 B4 Q* k0 @/ K//速度(1-10)
' x' s, P7 l$ W, u7 Mvar marqueespeed=3
" P" m+ [  L9 o# u7 F//背景颜色9 {  A  P% s6 H% {. Q1 d; n
var marqueebgcolor="#FFFFFF"
8 W4 X3 F( J0 [; Z- t( P) v$ \" c5 l6 s6 J//是否能暂停 (0=no. 1=yes)?
- q4 M. l( H; F0 W3 i! Mvar pauseit=19 J  @+ s+ h0 {6 }/ k
/ i9 {* E* ?! W7 Q7 t3 _
//修改显示内容
. w& p) F$ V- C3 B9 n) N3 [var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'& S; v8 R& s/ T/ G0 O+ @% g

% E2 a& T; S2 i$ F' U; ]9 p! l' _( \& ~9 U. O
////下面不需改变////////////8 W5 r& p) D; f! s% L+ z

  Y9 J* `2 J  |9 Pvar copyspeed=marqueespeed1 o9 b" U/ S. ?4 i
var pausespeed=(pauseit==0)? copyspeed: 0
- o( i" |1 X/ i% Tvar iedom=document.all||document.getElementById
6 d( B3 ~1 m9 a) R5 ^: ~if (iedom)* W6 w/ D4 Z) ?& j/ ~, N
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')' W. _7 e3 W! `0 R) d
var actualwidth=''& \' `4 ^1 V( v' l3 {
var cross_marquee, ns_marquee
8 w" S/ ]; f+ ^0 A* m3 O% Z" v  o9 {. t/ C+ V
function populate(){( U# t0 W$ L  O: @' B% n
if (iedom){
$ B3 `$ Z* c1 _: ?% Y5 Ucross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee& ?8 z3 R3 J; Q! ~1 I
cross_marquee.style.left=marqueewidth+8
; d& v9 d! H. v) h& e- m& y) tcross_marquee.innerHTML=marqueecontent. D: L% E' E% H" S( n
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
) n" G3 Q& I2 S  E3 x}* l( d5 V- |$ {8 d( J" p/ s, ^
else if (document.layers){2 n. G5 `1 f( D6 s4 f. O
ns_marquee=document.ns_marquee.document.ns_marquee2( r" E: \$ X3 L/ h1 t0 i% K
ns_marquee.left=marqueewidth+89 `  y: W- c  L7 G
ns_marquee.document.write(marqueecontent)
& F. r6 k4 ?- h. Yns_marquee.document.close()7 u/ g" d8 Y7 A) o; T* F% X/ h" r
actualwidth=ns_marquee.document.width, h& |( f8 \1 Q
}8 j5 I" a# C- J) j( f/ q  t. l" G
lefttime=setInterval("scrollmarquee()",20)0 w9 R4 I$ u: K/ ?) G; v+ A
}
, p' g- S) c: t0 r) ?. E5 z- M. Fwindow.onload=populate
2 a% l5 k0 d! {$ x
% `, Z1 Y3 j7 _  ~function scrollmarquee(){4 A; ]; R+ X5 k" f' P: h8 {# r1 K  f' g
if (iedom){- t. b0 S1 m# z: Y, u3 M
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)), G" i1 {2 L( S8 e0 ^. r
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed$ k  a% Z" T  v/ o! }
else! n$ i* g+ _- a1 T0 W1 J4 G
cross_marquee.style.left=marqueewidth+8! R$ z5 T. T* S1 q$ W

  w, t% x$ s/ g7 t& F}
4 \( |# n7 w& [else if (document.layers){
, R1 `& v4 o0 Z2 mif (ns_marquee.left>(actualwidth*(-1)+8))! m: p  A  D5 d; ^
ns_marquee.left-=copyspeed
; U; k$ K' c; e; ?  felse. I7 g; `# [7 w( \
ns_marquee.left=marqueewidth+8
0 k/ }/ W# R- D! b0 c}1 h- e- ?  N: n- M$ T
}% g# p, \( F, D$ _2 h. ^( y9 |) }
; B$ O. n+ m/ o1 F
if (iedom||document.layers){
  @/ H0 j& u' ?4 @4 Iwith (document){
1 ?& L6 J5 s4 q7 W: ]document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
+ L1 }6 m, W; N7 r, a& K2 Mif (iedom){
2 a2 S" {; e3 v& i* Y4 mwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
, O1 O/ I1 S4 V5 O: x9 p0 K5 qwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
: z* F( N. a; ^% P9 Y% K$ }% t9 z+ Xwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')& f7 ]8 g% _, d8 P, y
write('</div>')# ]+ Z+ B6 u' L0 a
}
4 J6 c+ Q1 i9 l- m! zelse if (document.layers){" U3 d9 G- D8 u! I
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
- s! g2 D/ V" L! g" @write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'); M' U. J- S# U) G$ k8 T8 h
write('</ilayer>')9 h+ ~8 g4 {# X
}, m* C1 {0 ^  E" C4 \4 |
document.write('</td></table>')
3 i4 d. g& C3 W}
& p) d! o2 A: W+ }}
6 B$ r: Y! }' _3 [+ q* V: o</script>

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