获得本站免费赞助空间请点这里
返回列表 发帖

网页之跑马灯文字特效

//修改宽度
  D4 ]( [6 S, Z0 o  e6 Lvar marqueewidth=300
  ~  v4 m/ T8 U//高度; q# [8 f" V7 _& a, @
var marqueeheight=25
$ u1 I& j9 d' ?8 R( t/ Y- K' x//速度(1-10), N3 G) d; F8 E3 a; a- `
var marqueespeed=3
( A' f/ Q/ g6 e4 a2 S' t' {//背景颜色4 r& ?$ U: _9 `$ B' R2 I
var marqueebgcolor="#FFFFFF"
. E7 b9 a' V+ x) {//是否能暂停 (0=no. 1=yes)?
) d3 ]+ b+ `4 m6 k1 w% Nvar pauseit=1' H* ]3 A" x9 n$ j5 a2 J7 A& z* |, u
5 B/ F- ~% e1 |& d, T1 o+ U1 e  V; o7 k# T
//修改显示内容, P% g. _9 d  I; F0 b( {' o
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
% ^" N6 Q" W% V1 g" }# r. L8 B( T9 ?# h9 j- a+ [' H* f
* @6 h* [7 i( n  g
////下面不需改变////////////
$ S% J8 D7 H, J# c' F0 X
- N3 X( e# [+ T( ~6 p+ p; M7 Mvar copyspeed=marqueespeed2 ]3 h" I$ K$ B! _( D" P. J
var pausespeed=(pauseit==0)? copyspeed: 00 X/ T3 h$ ?" e. D
var iedom=document.all||document.getElementById! C* z# Z3 o9 d1 ^5 A$ t
if (iedom)4 s" t3 O$ |$ M& |# j/ b+ |7 |
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
9 r3 o7 X0 s# S8 gvar actualwidth=''# B9 Q" r$ m" Z$ T
var cross_marquee, ns_marquee( v7 B$ q/ T1 i
3 j8 Y; y) J+ X6 G: o) U: a( h
function populate(){
$ x, u& K; b6 @6 R' n, ~( G" @8 N8 Rif (iedom){% H5 \% J( F2 D
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee/ h' ]) Q. S$ h& D6 k: B" [
cross_marquee.style.left=marqueewidth+8- d2 G( y7 c; A- t3 O
cross_marquee.innerHTML=marqueecontent
# V% B# m9 @$ {  ]actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
6 o! L$ A( \6 s  t}  h/ K9 B* ]7 H: {+ L
else if (document.layers){/ c& @" w, b/ T. D
ns_marquee=document.ns_marquee.document.ns_marquee2# }9 ]; b3 P6 y. G, _9 a
ns_marquee.left=marqueewidth+83 c7 @2 s  Z  S+ I+ L% h4 i& r  L
ns_marquee.document.write(marqueecontent)
1 `' \1 C, r3 _/ m7 F3 U1 G# i3 a' Xns_marquee.document.close()
# j9 B* y$ A! uactualwidth=ns_marquee.document.width
. J# M  U% U; |* J! Y# S2 v2 b) ?}& g  L+ Z$ y5 i3 {/ w7 J8 C7 B5 w% x. T
lefttime=setInterval("scrollmarquee()",20)
8 m9 k6 a) o1 L+ o/ Q}: g3 B5 n/ g+ i& ~  ?' K/ m3 I
window.onload=populate1 G! s3 H/ t# N) G  y  [; ?* v8 a

% q& C% x$ e8 rfunction scrollmarquee(){8 a7 Z/ [% p7 i+ X# g
if (iedom){: e( s* ~/ E" L
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))* F8 U2 q! a2 P
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
; r, T. J) O) {0 ^else
, i7 `1 e6 B( j$ ecross_marquee.style.left=marqueewidth+8+ Q2 x. `8 x7 j" t! y: y

4 P' _- t" ?6 w' J3 H/ V0 E: q}2 B% o: K" X7 Q; a
else if (document.layers){
0 Y* K0 [% H6 n; W1 P2 f6 X0 B/ Zif (ns_marquee.left>(actualwidth*(-1)+8))
- L! e: N8 K" J7 \! |: }, g) ?ns_marquee.left-=copyspeed
7 O$ [* y" P7 b8 G! @else
) _( q  M" g6 A1 m$ X5 q8 `ns_marquee.left=marqueewidth+8
$ ?, W( K- C1 @! \}7 }# Q' w3 L5 J; e
}' j. d' o/ b- r7 q3 Y. O2 i: m. {

- M  f' v+ T7 yif (iedom||document.layers){) t5 W0 `1 Y$ O" c; K! M
with (document){5 D5 N2 S9 z% _1 z- n
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
* d* K/ B; C+ u7 F  f, [2 |& ^if (iedom){
3 B  R) O( L, v8 {/ y' Mwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
0 T# V; N+ V4 p1 N" Z2 Bwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
/ e9 E; o, X5 `write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
5 x" \6 ^; @9 Rwrite('</div>')! a, @( Y' w0 G+ C/ q3 I7 ]
}- x- Q0 G6 F( s
else if (document.layers){: T$ ^. F2 q% Z! P1 b& y
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')2 p5 Y. i  J0 e  Y
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
0 Z" }% w, G" @% x- [write('</ilayer>')
+ @0 b7 b5 R9 z! z9 b2 w}
) f; M" F4 {8 z3 ]) c: J! w5 ?document.write('</td></table>')
2 S9 ~- C$ x8 [% i' i( O}
. h* f  C1 u6 L}& W% M) T8 B, t
</script>

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