返回列表 发帖

网页之跑马灯文字特效

//修改宽度
1 x+ f' C3 W0 S, svar marqueewidth=300
' c: T6 Z& m5 \  D5 D; m* y//高度+ b1 h2 ^) j: k: }& C8 ]# r
var marqueeheight=253 |1 Q/ I% E, R  p
//速度(1-10)6 S  }5 o8 z3 w5 R
var marqueespeed=3- Q+ c! K5 L9 V# m# s: Q2 f; R
//背景颜色
: ~# c8 ^6 g% p4 p& Nvar marqueebgcolor="#FFFFFF"' G. R4 z, s4 ~
//是否能暂停 (0=no. 1=yes)?
/ i4 t/ P$ ^9 e. Qvar pauseit=1% @9 ^9 j+ E  p5 k; H- g9 F

7 o/ I0 w* N! [5 X//修改显示内容) \5 ~) [8 Y4 d1 Z
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
& g  h7 }6 _" V5 l3 M+ n# g6 d; ~% V' ]/ k/ \3 ^
% w2 D/ ]% x. l6 k. h; m: ?9 t
////下面不需改变////////////1 }: U- }  D0 F, c# ~

* O, B0 s& n1 e4 [6 A, J' J7 s! Qvar copyspeed=marqueespeed
. a3 `. R- n% t2 c# d$ ?7 ]var pausespeed=(pauseit==0)? copyspeed: 0* [6 _+ a, ]4 b# q
var iedom=document.all||document.getElementById
' _7 S3 v4 r9 _/ D) O& U4 m$ Cif (iedom)$ ~. \' F. W* l( b2 M; t
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')8 P6 O; V) z- V0 n
var actualwidth=''/ H$ _% _2 z& c+ h7 E7 `
var cross_marquee, ns_marquee8 j6 e- C& H+ E: J( x! ^# {: ~1 v& E
; b7 M( P- i$ c+ C- w, t/ V
function populate(){
# s7 W2 @4 z( F! X" T7 n; W) ^3 V; xif (iedom){) M" n% ~1 w! n  o4 q! B; A6 G& y
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee' I% U$ n& o1 O5 \0 x
cross_marquee.style.left=marqueewidth+8' J$ w! f4 }4 O7 W
cross_marquee.innerHTML=marqueecontent3 z+ q* S. ]# o# e. D  S$ M
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
. G4 {- K' a# I. L}- ~1 c6 v. l1 h7 g; v
else if (document.layers){
; l5 ]- m$ c3 m( i& s$ _" Ons_marquee=document.ns_marquee.document.ns_marquee2( C) {: }4 }' \5 }+ R6 _
ns_marquee.left=marqueewidth+8
5 S1 u$ @; f% Jns_marquee.document.write(marqueecontent)
! w  |* h0 P& r* V" j1 v5 ?ns_marquee.document.close()0 L# {4 C( W! C% S# p
actualwidth=ns_marquee.document.width
0 s4 O! n2 i1 F3 o}
7 q( v. I0 U( j8 B9 a3 \lefttime=setInterval("scrollmarquee()",20)0 x  l2 p; }4 R
}
. z0 b: U# N; H, awindow.onload=populate' g! F- j% s. x0 P0 z5 T2 s

- E5 Z  R% S) E0 K5 p9 S  J9 kfunction scrollmarquee(){
+ r0 u* ~$ e! I3 I& E! A3 iif (iedom){
9 N8 P1 H: J$ y' C: D) u% {if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
. y" B- M. Z' c7 ~) J6 pcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed; k7 O. G' D5 {+ q* ]9 S; ?
else
7 u, {, T6 ?* W  N! Rcross_marquee.style.left=marqueewidth+8
8 L1 A5 \3 m' w& |+ m, ^3 i8 W# A8 x8 t6 C) T
}
- P! |+ K( ]: R5 Velse if (document.layers){. u3 v! X9 X* X) A2 R
if (ns_marquee.left>(actualwidth*(-1)+8))
% k3 \  [* B' V. z1 c( _; `ns_marquee.left-=copyspeed
$ J7 n* }6 _$ J2 ^0 xelse
* J* L) I% o" Z6 g8 e8 @9 gns_marquee.left=marqueewidth+8  |# }1 D  r7 ~4 ]8 W( Y
}
, w8 y! U( k8 r}/ _, _$ y7 ?" s0 I

# _: _1 _! C2 d+ lif (iedom||document.layers){
2 q1 ?( r+ h$ l" K( Owith (document){; u: n. H: e# q, |1 e( ^
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')7 r5 v* {9 m0 f, K; Q# d
if (iedom){. W3 \# `1 X$ L7 d
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
& G0 o1 Z4 c3 b, Kwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
6 t- {# z- y5 H" q1 u$ Iwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')% \4 m" ^7 s/ F: K1 `$ R$ x5 H
write('</div>')2 A. w- B% |. T- h
}
. e3 m6 ?. S% t0 a, i2 ^. x8 t# N( ielse if (document.layers){
, C$ H* `6 c* }write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')4 Q6 |& O  w; k+ e
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
9 o  p9 X+ T( B: F: [; `+ Cwrite('</ilayer>')+ J$ }; ~2 @$ j  x; m) d
}5 \/ }2 S1 }+ G& E6 D* `0 q/ X
document.write('</td></table>')
6 O! @2 `0 g6 P& B$ N* w) B}5 n  ?6 t+ D3 |5 A! z
}
( |' ]8 ^, ]1 h/ T</script>

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