返回列表 发帖

网页之跑马灯文字特效

//修改宽度7 h+ s# r' a! N3 k  T0 i
var marqueewidth=3001 U+ I# u- N4 M0 D7 n0 T
//高度
6 S% s# e3 f" Xvar marqueeheight=25& {2 R. {$ s/ b* ~: q
//速度(1-10)
, T' |2 e& w8 f; ^var marqueespeed=3
$ C7 r' R6 K/ X6 W//背景颜色0 F7 c$ N5 j4 P  K9 W' I
var marqueebgcolor="#FFFFFF"6 L  [( p' G7 H2 f' C$ t% h4 v7 @
//是否能暂停 (0=no. 1=yes)?! J" v" n( B$ P3 f9 k- q) H
var pauseit=1
% y! Q- A3 M- i( k, @/ o+ p3 e# `! N& K- g
//修改显示内容
0 g5 r3 U: I' D8 Cvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
+ \' W" o5 Y3 {4 d4 q* y& x
# Z* t! ~. O8 `+ ]' k
: d' P& Y8 T$ y0 m; Y////下面不需改变////////////
5 O1 g9 q7 Q6 b6 l/ \
# g" i) S' `/ ~' \5 @  p% Jvar copyspeed=marqueespeed
9 c6 b8 v( b! Fvar pausespeed=(pauseit==0)? copyspeed: 0
1 u7 A( ?% O2 Q' Tvar iedom=document.all||document.getElementById
: g. |( t; B7 m. z' E' @if (iedom)# `" L- H$ d# r8 }1 x
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
6 D  }7 w, G: @1 W. M5 Wvar actualwidth=''
' }& A# L# U( P+ y  S0 e, ?var cross_marquee, ns_marquee
( p" m( F0 ]8 g+ B# R# z
8 H, c' q8 V5 w0 \  N5 ]& K2 c& cfunction populate(){
( t7 l: _$ `% M/ U0 Q# Wif (iedom){
8 w0 U# X4 s: F) A; N0 across_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
# c+ l2 Q5 z, y! `8 x$ [cross_marquee.style.left=marqueewidth+8# {' Y  L" G8 E3 q  {' c$ N
cross_marquee.innerHTML=marqueecontent) K% W9 F! S; X* o! k" t2 m7 o5 i# T
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth+ U; C1 T1 v, k: R
}
3 C, q% ?9 {; _8 P$ Aelse if (document.layers){4 o1 s, |3 |1 `3 H! t! C. r' z5 B. v
ns_marquee=document.ns_marquee.document.ns_marquee2, d5 U1 O6 B& O0 Z. B: I
ns_marquee.left=marqueewidth+89 T+ |) i& ?. Y& z+ L! \+ z% p# L
ns_marquee.document.write(marqueecontent): P7 Q- D; J- W) T. q4 I) K
ns_marquee.document.close()+ P( |: c0 f9 m
actualwidth=ns_marquee.document.width! [: d% O0 {! d7 a" T& r
}
6 r7 ?* v# Z) S% Q3 olefttime=setInterval("scrollmarquee()",20)
# B) i* l" C- g1 }! P}* W6 I3 z# a8 w, b) T0 j0 m
window.onload=populate
0 {) A0 b0 @7 V9 }7 h1 C8 ]/ [: {  j/ B5 t! [2 M0 P- u: K
function scrollmarquee(){0 b7 X1 A( ~$ i
if (iedom){4 i# a1 C( \+ {! t5 }; m7 `+ y# y" y
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))" g  F# K4 J4 |7 c2 ?! g  ?
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed5 [- [8 ~7 ]4 P; o: n7 E
else, Q& `% _; f/ Y, d
cross_marquee.style.left=marqueewidth+8+ S" a; R- l; s* c: u2 q# j

! E! }& \1 K$ @3 S; o4 [! f1 q( v}
% A! U/ j9 \7 gelse if (document.layers){
- j* j: e4 W! M' l1 wif (ns_marquee.left>(actualwidth*(-1)+8))4 @6 U, D  o! s2 d
ns_marquee.left-=copyspeed
- G4 }+ U' ^2 ~4 v& ~8 W; aelse
7 t; O! q" i1 [. `  U' nns_marquee.left=marqueewidth+8
# z  A$ k" J  o6 ~& f}0 G$ G( k- d. @7 s  i6 a8 y
}# i( G% e4 C  r6 _6 X

) N, Q) ^8 ^* ~+ K7 Pif (iedom||document.layers){
) r; v3 }# l* D  H0 X; ~5 Ywith (document){
" l  ]3 T9 T8 O( X! T" Bdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')" ~; ?, ^7 M. h, w  W' I
if (iedom){
+ f  e7 {( q7 z+ Twrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
! t9 y4 L# r* K9 G# Mwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
; E3 O' O  t) @+ [: a6 ^write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
/ p5 `# l: M" ewrite('</div>')
! Y& W6 I' H3 R0 L+ j}
0 `* E6 [8 ]+ k* G3 }- S/ welse if (document.layers){+ W9 S4 [0 |7 W' m, N' ^$ o
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')/ F: [0 t( k) ]
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
; [7 _; q/ ], n3 P8 }8 kwrite('</ilayer>')7 t* ~) \' T- \+ P, i6 Q1 {6 d, v: u
}3 j+ |6 r7 m3 M( w. @: W( `) A
document.write('</td></table>')
8 }( f7 ^6 r+ t8 K/ \3 x& H* Y}
! b% |# B( B8 k6 H! \}2 V! g2 b& B" @4 ^( R* H, x
</script>

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