返回列表 发帖

网页之跑马灯文字特效

//修改宽度
5 u0 R% J$ V0 S8 M. _$ |var marqueewidth=300
% ^3 F: S. ^) _" Z//高度
3 G% T7 ?, h  A3 A' O! I: C& t) ?var marqueeheight=25
8 e+ v/ Y7 \' I, f) ?" k6 v//速度(1-10)8 g8 f! u* f2 m- {! m, a6 V
var marqueespeed=3( [. A( f$ B8 h2 a' Q) w0 k2 f( [
//背景颜色. ~; G3 i! M+ R- t. S: o# s
var marqueebgcolor="#FFFFFF"
+ k8 t" `& a# D//是否能暂停 (0=no. 1=yes)?$ q) [/ d" M, a7 A( T
var pauseit=1
1 b( K0 ^! p' M( Q# f4 I$ q( n
//修改显示内容; W3 x5 M* l; f9 q+ c7 d, h) w
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
, Y% |# Q; w) H' H2 v* v9 K; n3 Y  L* H6 }" g! F+ o" e3 j
9 v' g$ a! U% w5 v
////下面不需改变////////////& Q# P2 P) ?8 _$ V1 K

+ c& |  @6 ]/ r5 g0 Q: Evar copyspeed=marqueespeed  l' K2 s1 N% a" a) ~$ h0 B" |- y
var pausespeed=(pauseit==0)? copyspeed: 0# T2 M4 y' m2 X# l
var iedom=document.all||document.getElementById
6 K# \) H% p% F. Vif (iedom)
( a7 f! E+ U, C# j& [( `document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
9 C' |( y' U, j! ^' x( qvar actualwidth=''0 t; d% Y# N. P- K* p9 r7 r; a
var cross_marquee, ns_marquee
7 j& t+ N, n, _3 e' @% M/ Z( J1 Y( e$ J
function populate(){
0 V  ?% P5 l: F8 g/ j# s1 Xif (iedom){4 ]" x9 K4 i0 {  j
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
: M) H8 j6 u7 Rcross_marquee.style.left=marqueewidth+84 R1 r' b9 ?, D8 ~- j1 n, `
cross_marquee.innerHTML=marqueecontent7 T- x+ a9 x( ?* N+ b5 u0 a1 _# L
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth+ P- r1 |7 i% f/ @( g9 m
}. g- c! D& {2 k4 e' Q
else if (document.layers){
- [6 N& n" W  P9 |8 k- H* gns_marquee=document.ns_marquee.document.ns_marquee25 J* S2 J, y5 ~+ L7 G2 t; g
ns_marquee.left=marqueewidth+8& U. w. V0 B! W
ns_marquee.document.write(marqueecontent)
4 b0 f' C3 w: ~# fns_marquee.document.close()
. R; ]  O' C* ^, s# ]* d! eactualwidth=ns_marquee.document.width3 O" t3 i3 h2 x8 Z: n7 C: p" k
}
; V+ H8 M4 y6 b# p! z7 a" f  ulefttime=setInterval("scrollmarquee()",20)
7 {  @; U% N" a6 ~}3 ?3 ^1 V- t9 Z, D! @) v
window.onload=populate7 @0 O! \9 _8 D# y, }6 k

0 `; M* O% ], {, a0 \& h) U+ pfunction scrollmarquee(){+ ^, S" l4 H5 D0 b; {# A% J
if (iedom){
: d8 w% j  }3 d+ i7 ?% Tif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
/ _+ ^- E( l" G5 Ocross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed: d9 m4 |# ?  A( K1 |7 g
else* S+ m+ \6 O* ^6 W
cross_marquee.style.left=marqueewidth+8
& w* z. c% ]. Q( U5 L/ f  W2 @4 M. }7 J- h, Y! c" T+ |/ v
}3 H/ d3 F* d5 {) w# F- u
else if (document.layers){! c( @: r7 {- y( U1 l2 t* {$ F
if (ns_marquee.left>(actualwidth*(-1)+8))$ n) r( b  N! j
ns_marquee.left-=copyspeed
" E9 G' ~# c9 J9 f3 Aelse
0 x8 j: w' }/ f$ Qns_marquee.left=marqueewidth+8
/ @9 I8 ]4 v6 h* R9 h9 x" H" l  r}
% c# l0 Q7 r  F}, |1 ]* F( j( W* Y+ T2 X& w

1 M; |: B, }8 F" k) Z- Sif (iedom||document.layers){% @6 v: n9 e7 q# [# |" [
with (document){+ X: f! j) o) F. u$ x$ B& Q; j
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')/ i8 G6 R* x: R: K  T
if (iedom){  B- r0 r, x- N, V% d
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')0 d, i- a6 ~7 E
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')8 W+ s6 N5 x0 c; ]0 ?8 c
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
: F. J0 g! [$ `% w$ gwrite('</div>')
5 {- {8 m8 j9 R- j  T}. k" P* c3 k4 b$ q9 v9 Q) g
else if (document.layers){
: _; d7 \4 \' q1 y8 J( kwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
# C0 l; t! ]( u4 ]7 M  J0 Q2 [write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')4 p; F8 ~  ~8 k) U  v
write('</ilayer>')/ ]/ C( h; j: ~2 r% n' R: ]
}5 e$ R5 R3 Z# o$ w, O
document.write('</td></table>')
: Z2 w, r  n5 O8 O  D$ H3 ^) t}
3 ?- \# ~2 J- Z9 I}
" _' P) B5 Q1 K* G0 A4 B</script>

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