返回列表 发帖

网页之跑马灯文字特效

//修改宽度( d/ C! c* {' e$ d% b
var marqueewidth=300
6 P' R, g% ]5 U$ _7 J//高度
' }$ @7 I: t: m; D7 ?5 Z, _5 kvar marqueeheight=25
) V$ G$ Z( V0 Q//速度(1-10)
" n9 S8 Q7 v. y6 \, p1 Z8 mvar marqueespeed=3
( ~, L( e# a0 {+ a) v//背景颜色
! Y5 C: L- t3 i- E- {) svar marqueebgcolor="#FFFFFF", T% G' Y" M/ J, g9 q$ F) i# _) K
//是否能暂停 (0=no. 1=yes)?
, M: P5 E; x! ?) x: qvar pauseit=1
' E. i5 m5 o6 s$ _/ E0 [% u+ ~0 l2 x
//修改显示内容  ?$ J7 s/ F7 b( k1 N, N8 B, l
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'9 ^% u1 M( O$ H9 V  u  b# y

( `  G! a( x- A- I5 ^/ Z
& j& I9 O; ~3 [0 E3 f* y3 M////下面不需改变////////////0 l% Y4 M1 E. e; U# [

' P2 ?- [7 o( y% o- pvar copyspeed=marqueespeed. ]1 P% s0 m) u$ o6 l0 d
var pausespeed=(pauseit==0)? copyspeed: 0! b. J8 z* J) s' I8 {# I! N
var iedom=document.all||document.getElementById
" Q2 P! z' l- x; a; [, r- C0 L/ vif (iedom)
" H( B$ w0 K- ]6 f$ b* Z8 hdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'). |7 i2 m1 V4 H9 E5 D% o
var actualwidth=''
8 Y7 q) G3 F  _8 w' u& rvar cross_marquee, ns_marquee
+ X, w. n. O' C& ]5 \
: D& V+ g6 G& y  w1 L$ yfunction populate(){
* l# N1 Q% A& x: Bif (iedom){& P# M' A' S+ F- }! ]. l
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
( K; d) K9 u8 ~  ^, Vcross_marquee.style.left=marqueewidth+8
. D4 M6 w* I, o' y. F5 h+ Across_marquee.innerHTML=marqueecontent! b- g- ^+ _: }. \( N, R# M+ i
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
8 q& e- X  n/ }# N  `6 d}
4 i3 [, s1 A9 d. [else if (document.layers){) q' }$ X$ E* L0 V
ns_marquee=document.ns_marquee.document.ns_marquee2  q* Y! e% v( o# d# n9 s
ns_marquee.left=marqueewidth+88 @1 c) P+ d4 g% I1 v
ns_marquee.document.write(marqueecontent)% D8 [0 T+ ]% C& ]$ q
ns_marquee.document.close()% A9 p& s# Q0 N, R1 G* F4 ~
actualwidth=ns_marquee.document.width$ K" t4 w) F  E) H
}1 v3 D* t5 R9 T
lefttime=setInterval("scrollmarquee()",20)* X9 x5 F" X% r8 Y! P8 y1 `  X
}- D& I* ]1 _0 A+ T+ k4 l1 c
window.onload=populate
: F* _2 T% ~8 D0 L# }, N
' A$ A8 v) ?$ X! k3 U1 C3 \6 g! ffunction scrollmarquee(){
' U- [- j& F$ a4 j% Rif (iedom){
- w* d8 W3 K+ _if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
# o* ~1 Q8 t+ E% t' a% _: lcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed2 W4 |- S; N8 c
else" Z% }8 k- `7 F9 H/ l1 b
cross_marquee.style.left=marqueewidth+8& H, P4 R* e5 G5 q  ~9 [
, z# s5 ?+ |1 c; H& u$ R" v
}% d- W  R( p: F' }+ i8 Y" p: T
else if (document.layers){2 b5 p1 \7 W9 I: C0 L* a
if (ns_marquee.left>(actualwidth*(-1)+8)); T' W; W& O- x7 X3 w: u
ns_marquee.left-=copyspeed
7 m( `+ A# Z9 d, zelse4 E4 f4 Z1 X! x. ^" b& Z4 g6 ?
ns_marquee.left=marqueewidth+82 p! R5 \: }: W' x4 C
}
, j/ W& `8 S1 |8 X& h}* K1 R; R$ M# E( b

8 W- f3 e1 r' g" P+ e2 d) Yif (iedom||document.layers){( t. c2 M( P" z
with (document){
! @- R. [2 ^3 tdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
1 F. \  A' t4 ]$ x# b2 gif (iedom){3 ~; ~* j2 r0 y) B6 H7 s
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')# V) U- c% w* e
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')& I3 Q* E! r) @
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
; S2 F5 d" H* T% p! Q  y1 S$ v3 uwrite('</div>')
4 C0 t) I. T# }}( q: _: I. B0 |7 m& V
else if (document.layers){. ]  b1 g1 q! S6 F
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
- J$ P$ V5 W4 }9 U" `write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
& s2 C6 u# D. S2 N3 C" U( L" }' D% }write('</ilayer>')
$ E) e6 S3 o3 B1 D}% r! {9 p' A3 x
document.write('</td></table>')7 K. A+ Y% o2 [! \
}
1 p8 \* o8 H, U# f; p: S}/ X2 H5 r) E( }1 l  G# j: `
</script>

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