返回列表 发帖

网页之跑马灯文字特效

//修改宽度7 c* }5 q- d7 F& {) f, x
var marqueewidth=3004 t, N8 q# h4 X% c+ }. @) Q
//高度
2 n7 o: v$ B/ u9 T* f/ qvar marqueeheight=25
0 O* h# L1 l2 B; U) X9 Z//速度(1-10)
+ w$ t# D- t$ h  |var marqueespeed=37 r# A( i& j* z" @8 k. w
//背景颜色
( P# X" W: i( G( \3 H! l& ^var marqueebgcolor="#FFFFFF"
# Q, l9 h0 d' @) f( k/ T  H//是否能暂停 (0=no. 1=yes)?& P3 @! v; r2 I3 n6 p9 j5 ]
var pauseit=17 [3 p, x, v, _. q8 z

. i# p) [( f- `$ B! D7 l//修改显示内容3 l1 }( c. b+ @, n+ E
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
. B1 j' L& O& Z2 Y
8 c$ o0 S, P& Y* Z; F; e# a
8 f  b' p8 u7 Q7 H! Z) M- S7 Q////下面不需改变////////////
( O9 I+ l) ^2 g% H/ c" L  g# z! \9 y, l; A  O% w8 }
var copyspeed=marqueespeed
. m4 h+ ]% \: H! `) j  Zvar pausespeed=(pauseit==0)? copyspeed: 08 Y4 H+ \. z% I$ }
var iedom=document.all||document.getElementById( [+ x5 B6 }* n4 b" n3 f$ b
if (iedom)' U- C9 X8 @( p
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')- @$ u: m8 t) i. _
var actualwidth=''
. U$ i# Q: o! Vvar cross_marquee, ns_marquee) F" Y" v  d9 X% U, Y
0 R( W8 B- r' J9 @. R
function populate(){
' ?7 p5 |* f" q* g1 e. Uif (iedom){% J6 m" `7 D$ j
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
; @8 y$ w. ~4 z4 U; R% u% kcross_marquee.style.left=marqueewidth+8. `7 z8 N* f1 f) A
cross_marquee.innerHTML=marqueecontent
' |  s+ z0 Z! W9 M+ Iactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth1 s" P8 D! j$ r1 @6 T8 w4 G! X
}* h0 _1 `" F  p( X
else if (document.layers){
( C' X9 ^* M. Pns_marquee=document.ns_marquee.document.ns_marquee2! ~$ n, O' J% t2 J& C4 k1 m
ns_marquee.left=marqueewidth+8) g& Y7 S0 u) d0 E9 X$ [
ns_marquee.document.write(marqueecontent)2 M7 I8 T% @. R, v
ns_marquee.document.close(): ~4 F4 l2 ~* Q" m. B! V. d# z2 @
actualwidth=ns_marquee.document.width! Q5 K' V) u" ?" j3 h8 B2 n
}6 A! k$ A4 d2 y# L4 Y6 q2 s
lefttime=setInterval("scrollmarquee()",20)' E+ N" x4 L: G) v# [0 \( V- a+ v
}
& i- n4 D* x/ Cwindow.onload=populate
; a! @( V% F2 [9 P3 ?; d
; F1 G- Q8 D0 nfunction scrollmarquee(){8 U! {" `  {; n. H5 c3 k$ c
if (iedom){2 G0 H  S# m  j8 C* y, J7 F
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
$ z1 ]  g+ Q/ l/ s9 ]% b" jcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
6 a# A6 L0 ~$ _+ A/ q' |, jelse( c# U0 _) ?3 J" f5 `4 H
cross_marquee.style.left=marqueewidth+8
/ M8 k. X4 V0 r) P# w+ i6 @9 ^- g$ l- {8 c
}
2 T% y" i, S; N5 M  Z( }else if (document.layers){# K' J$ W( }, k- {% _' c2 C
if (ns_marquee.left>(actualwidth*(-1)+8))
% S  B5 S. z% L, C% kns_marquee.left-=copyspeed
2 C; \  X/ f9 b) q' aelse
+ |) B: ^1 B, ?ns_marquee.left=marqueewidth+8( f  \" [; E; o  X4 i- t6 s0 H% Q
}9 J( q  u& d* V
}
: j- }! e1 Q) o8 T6 W3 o) E, X4 `' o8 B9 H; z) y5 Y6 f# d
if (iedom||document.layers){* [' ?  @$ ]" L/ F  @8 {% G) }
with (document){0 A# B  ^: h, ?- l
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
0 c/ }# A/ P6 M) m4 ~if (iedom){# p: w. J& n7 A
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
6 y4 B# z3 T; ~. O1 `4 ?write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')( g" Y& m( O" s! u; m9 U
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
+ w: |; ?2 D% z# y# Zwrite('</div>')' b' l; Q5 l) b5 F3 ^! d
}
+ l  Y: l# w" Eelse if (document.layers){
% O+ M8 V( s! ^- S, _* j# iwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
, e7 D: d7 U: x2 I% H) B1 Uwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
5 N- l  ]/ g( D3 a3 `write('</ilayer>')
! b- n, _* _) P6 U, u( ?}
4 H' r' j. W4 sdocument.write('</td></table>')
$ ^" |6 N( O. A, K  D1 n0 x}
- V7 y  p4 f1 V3 ]" k}
7 @" v6 T, w9 l" R: M+ ~</script>

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