返回列表 发帖

网页之跑马灯文字特效

//修改宽度. [! n! q1 D/ M' ]) q" b: }
var marqueewidth=3001 b' J/ Q# p! S' q
//高度+ H$ o  r& x3 p4 }
var marqueeheight=25  O/ x) n4 h* ~
//速度(1-10)0 m2 X6 u- @) a/ t, m) g
var marqueespeed=3/ v( o' j' h6 k; U( {
//背景颜色
4 v0 I4 A  R* T9 {5 Yvar marqueebgcolor="#FFFFFF"
+ ~3 r6 V+ u0 [; v- t7 k//是否能暂停 (0=no. 1=yes)?
1 Y' y, ]2 H9 |; J9 nvar pauseit=1
% F4 \6 z6 l7 L: C4 q
# @/ a6 D7 e2 }/ @( t( u* O//修改显示内容+ f5 Z/ W# z" b7 H- p# y% s) [
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'# O9 j7 i- u, ^3 C' i; C% M
& }/ M: ]6 j# t, h+ f" T! Q

. k# ]1 u6 T8 L) G# s  C////下面不需改变////////////! F& C1 R% n. `* f- w; t$ ?: j
- W* K1 E+ ~1 M3 l+ |+ Z
var copyspeed=marqueespeed
7 ~' _: n8 M' U+ Dvar pausespeed=(pauseit==0)? copyspeed: 04 \; U" V% S/ A1 g
var iedom=document.all||document.getElementById- _) `' B7 ~( p5 G; l( Y+ S6 I; Z: z
if (iedom), \# h0 ^/ _& H
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
2 l8 N6 Z* d- bvar actualwidth=''' N+ ]9 v5 A( o7 \
var cross_marquee, ns_marquee, |1 S* x2 n4 _) q6 E
+ g/ r- z7 ^5 _' B
function populate(){0 w1 c0 W5 c5 o, g& ~
if (iedom){
( s* U7 h7 a! ]- icross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee& s# ^7 ~: X% a! H- z
cross_marquee.style.left=marqueewidth+8
- x6 w( u1 l7 i2 S! ?cross_marquee.innerHTML=marqueecontent! r* p' }# e5 B# n
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
6 b3 Z+ ~! ~  f- j4 f& c}
5 Y/ u* f6 ~3 V0 xelse if (document.layers){# [) P+ F! m0 V* O& z
ns_marquee=document.ns_marquee.document.ns_marquee20 W3 D: {! x: \$ W( y4 c# f
ns_marquee.left=marqueewidth+8' p! Y6 X2 E. ^9 n. T. E2 B
ns_marquee.document.write(marqueecontent)& K# G) `& v( c3 k& V
ns_marquee.document.close()4 o2 U3 l9 @- H0 ?6 p2 p
actualwidth=ns_marquee.document.width& }! ~- q6 j& r7 @) `+ ]
}* i) T+ S8 f1 G3 ]' u
lefttime=setInterval("scrollmarquee()",20)" u2 I9 d( Z$ q2 y3 Z
}
, h8 X+ h7 ]. B1 iwindow.onload=populate
$ Z# q9 R" Q1 n' @  m) d0 J0 k
( a! i/ z; E& X8 Ufunction scrollmarquee(){: D! S5 r' ^8 u  s: O# |& E+ c; y
if (iedom){
# `2 x9 J4 M: c- U1 @if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
1 ?8 x' ^. ]8 Q2 x" P5 ]& p7 bcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
; [/ w' m5 [, X" O2 A4 D4 \  helse7 ~1 @3 D5 [( P
cross_marquee.style.left=marqueewidth+8! E7 ]/ Q) [+ Z4 w

. p$ h- M0 {5 }% H1 t}. O7 i, P! {0 C$ S* K' A2 j
else if (document.layers){' r, z5 l) T; S! \
if (ns_marquee.left>(actualwidth*(-1)+8))* d/ I% }1 p5 ]% J* t/ q  ]
ns_marquee.left-=copyspeed+ [) \+ q% m) W" ]
else4 J, A2 w9 ~! _5 s
ns_marquee.left=marqueewidth+8% U/ {6 f/ A- |2 q% D# f
}
$ D6 {5 m. }6 [# v7 \6 w* ~, ]}
; [0 g' t2 i* d
+ B( {1 K+ `, [9 ]) e3 j- U# X% B, K' U) ~if (iedom||document.layers){( A0 m: J4 T* q7 t- U$ n/ a. }( N
with (document){& M/ t- t# ^) i+ w9 m( O4 `4 r0 S
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')( z1 u* T+ \- x: i  m
if (iedom){
( V  x) ~! N7 M/ |: V2 uwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')0 x% o  _. p0 {# r, W- a
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')& c( z3 O; I7 a  T7 Y
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')0 M' Y0 K2 X$ |( T
write('</div>')
0 l1 i+ a6 G4 a9 S3 h- d4 r7 T}
# }, v* ]* b) E9 d* I% U6 `" q' welse if (document.layers){; t' B% [3 [  N" O4 R: ^: o( C
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
5 x  D  Y8 E) X. I3 S, e, wwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
8 \  f( M1 r% t6 Dwrite('</ilayer>')6 U  m* P; i9 a8 G% J6 Z5 z6 T
}- k$ a. P; B& _" J6 b
document.write('</td></table>')
% F. D- ^; Y% m* d& u" @}5 R" W2 a) D# b1 G% m
}
/ s% E% y5 c/ U# y</script>

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