返回列表 发帖

网页之跑马灯文字特效

//修改宽度
7 `* Z8 J/ K6 n! i% Avar marqueewidth=300
# y/ [- {- `0 W& g//高度8 d" S5 q8 e! C5 n) d  a% V
var marqueeheight=25
# y  W7 S7 v2 p1 W  ]//速度(1-10)
$ f) G% x0 ]. o9 K, a. Y2 i- `9 gvar marqueespeed=3
9 n2 I  I! U# O0 {" I6 `: [1 D//背景颜色5 ]  U: r; n- D0 x6 ?
var marqueebgcolor="#FFFFFF"
, o& k7 \- m+ F- z//是否能暂停 (0=no. 1=yes)?( }7 z5 R: F) {
var pauseit=1
9 Q: [: ^$ D) \( t( P/ l. G
7 ?6 m6 z2 ]" e0 n/ W/ Q& n) t7 M//修改显示内容
$ n% @) q; |* ]! |) j+ n$ F7 k+ o2 D; evar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'3 J$ Y6 h6 ~( X) Y1 n; N
( y3 A! }" v3 M& M
9 _. f  m  ]# h7 [7 Q! z
////下面不需改变////////////* {7 i  K3 r9 J. u8 c0 n

( j# a# H1 c3 H8 kvar copyspeed=marqueespeed& k5 H% H0 p' p. N7 o- H! G& H
var pausespeed=(pauseit==0)? copyspeed: 0( r+ W, i9 s& j
var iedom=document.all||document.getElementById
$ x4 d5 ]5 f6 {7 ?if (iedom)- Y4 |+ T8 T% Q; Y# k. C4 K& {
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
3 a0 B6 ?, i- ^var actualwidth=''
- e* b0 T2 e! c2 _- g- [var cross_marquee, ns_marquee% t7 T) r! f; h- t. q

' Z6 G# t( y1 m0 F, A  g6 H) afunction populate(){2 j6 `' J3 J9 T# j7 @4 Z, G  `$ g
if (iedom){8 N  x# r1 a6 {" u1 S/ [; _& O
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
8 k5 k" _. f9 a+ U4 G! h, f: kcross_marquee.style.left=marqueewidth+8
- l" R- U1 f' h. l( kcross_marquee.innerHTML=marqueecontent& ^8 X0 I% _8 d% M" B' N  C3 s) K  |
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
3 c* |  d" T" X# F) P6 m9 l}' w# b; o: w, A8 g8 J% \
else if (document.layers){
+ s/ W$ E5 W2 |9 l+ j# Jns_marquee=document.ns_marquee.document.ns_marquee26 g- C9 I& N3 U
ns_marquee.left=marqueewidth+8+ Z! F7 O' r% {& l
ns_marquee.document.write(marqueecontent)
, j# a, U; N7 B$ s+ Wns_marquee.document.close(), a' I* u, y. G! W
actualwidth=ns_marquee.document.width
! v6 b" x& R5 S* P}
/ b# e. [+ t% y/ S- d: Vlefttime=setInterval("scrollmarquee()",20)2 M/ K. J5 d( d- u
}
6 N: ?" d1 n3 }9 G5 q$ Rwindow.onload=populate
3 l* i( S2 b  M5 U5 g$ D. m  f) q2 h3 J6 J
function scrollmarquee(){# P/ n. B4 r2 L- Q1 G
if (iedom){
0 s  a5 r: f- f! K- }2 `if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))7 @" z  \' e, l+ G9 U1 [8 d
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
1 f; j9 E! m: ?* n! z3 v5 Qelse0 O+ A5 v) \5 P; x4 g! b8 @
cross_marquee.style.left=marqueewidth+8
0 @) L) J3 n9 ~8 Q2 X. b
, o; U% E7 w! F+ [" ~; O0 n  z" E. \}
! m3 N2 W* Q5 r9 [( _else if (document.layers){' s% v4 p( Y7 v
if (ns_marquee.left>(actualwidth*(-1)+8))
! k6 z+ r* R* s) h$ p, fns_marquee.left-=copyspeed
. H& H6 f. O  Z; I" ^else1 o3 f2 j# T. F( F+ i$ F
ns_marquee.left=marqueewidth+8
7 G  o  E$ P. `+ [) M6 M) {}
: N! s. V) |% y* t# O}5 X* o4 {8 w! l7 w& v7 d
* G2 w; ~- p6 `! q3 c+ C% o' S% ~
if (iedom||document.layers){7 F$ S) c: `8 @1 u) p8 \+ F
with (document){2 |# D, H% F/ ~) q2 d1 X. s
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
8 s) B0 A- T2 m/ D' Xif (iedom){5 A& q, d+ E: [4 W
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')9 S; @% C; b* Z0 D, W
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')0 N1 S7 J' U) k$ S
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')9 E# y/ h( a3 {# i4 J: q7 I
write('</div>'); E# S' h" r& c8 o, n- t% e
}' ^# P, n7 s+ l
else if (document.layers){
+ Y1 h1 F  t6 R, `write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
- n" F' x4 Z( c0 w+ K. ?3 q/ }& owrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')% E7 H% K/ k9 d8 l$ |+ G, b' g
write('</ilayer>')
: y: r7 C, m0 F- n}* ~8 P' v7 `( [- B. F6 r
document.write('</td></table>')# D5 r( S( [. r6 }8 p
}
% v- E6 _, e! {# K+ x6 \}
7 b2 d* A  w: i& ?& E2 |% L$ I</script>

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