返回列表 发帖

网页之跑马灯文字特效

//修改宽度
% Z: l( W; r! K: ]0 Qvar marqueewidth=300
3 k# }4 A/ d/ B+ h% U) T  {/ G! V: j6 d9 }//高度
$ d3 R1 a) q# j1 Uvar marqueeheight=25* M8 q3 P% x) {  A( D" T% |: c
//速度(1-10)
( [' _3 E8 \- W/ c/ v$ }var marqueespeed=3' O/ q( y8 m) _  v5 {; K4 ^! G
//背景颜色( E- o% a9 e1 b2 H- w
var marqueebgcolor="#FFFFFF"
8 j0 c: ?8 f  ?5 j$ `//是否能暂停 (0=no. 1=yes)?3 j$ c# w8 M3 c" J# s) `
var pauseit=1/ l7 J$ e' w7 ?( Y4 B# V

7 |9 o5 w! p+ s$ I# `( h% a4 [( {" D//修改显示内容; f9 y8 X; O1 n
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
$ z4 m: u0 Z9 K
* Q: `  A0 K) `$ u% h, _/ Q3 u" J% a# m- r
////下面不需改变////////////
1 \  [! S; h& q
, s& Y9 z# [% _var copyspeed=marqueespeed
9 a, o3 I  ?1 |6 E& o, fvar pausespeed=(pauseit==0)? copyspeed: 0
4 I- b" o# w% ~: M6 @& T6 Avar iedom=document.all||document.getElementById
; @1 N1 }, c6 Qif (iedom)
+ B9 Z3 N1 T( }1 d  D! F$ K9 vdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')5 P/ X, ]/ I$ {# {4 _; h
var actualwidth=''
; g+ J1 ^3 \0 C1 vvar cross_marquee, ns_marquee+ E  j! q9 O: d6 a+ A6 k
5 J. m3 b6 R: \; ^! o' h; j
function populate(){. a* }& i" O- S5 n3 |8 F# y* \
if (iedom){/ N# e4 l1 E) U* p/ ]: X
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
- X* w( M* J4 ?8 b% F# I# F% _cross_marquee.style.left=marqueewidth+8  j% r0 ^2 Q, g9 e, n) ]& D! Z
cross_marquee.innerHTML=marqueecontent
# i9 P# d' {( d9 I/ n0 U/ ~actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
( b" N8 b; I* x}
% @. V& W- B1 {! x# {; [7 f' E: `: Yelse if (document.layers){
* Y' N: w; O# @' c! ]7 G: Ons_marquee=document.ns_marquee.document.ns_marquee27 p7 h' q! B, I" j% h% O3 Q
ns_marquee.left=marqueewidth+8
5 Z" k0 Z: M% xns_marquee.document.write(marqueecontent)) ~; r! |8 U) Z4 t( J* Q- o1 K
ns_marquee.document.close()
8 F! H. ]8 k/ @4 o# |6 s+ pactualwidth=ns_marquee.document.width9 N# i) r: B. c; X: L0 X
}
' p% @3 m: F( wlefttime=setInterval("scrollmarquee()",20)
9 G/ y% v# p- w8 a# v' G8 l$ ?}
2 e0 d' t9 d. M8 n) Owindow.onload=populate- s( g4 O6 v! ^: Q8 Q- T
( ?: F  k  @! E3 O+ d% Q
function scrollmarquee(){+ \2 i" ^6 y5 t) z
if (iedom){
  W7 z  j) `6 U$ Q% \if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))3 H& E  D! E2 I6 S
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
* q" ~5 v4 H! V8 J) \! Z0 Pelse4 {( A. x# G- Y0 a1 h3 i
cross_marquee.style.left=marqueewidth+8; n! S# ^. _6 A7 d; ?: M

7 E' d( E" V& ?! K' ?}
# I$ J1 h/ E) R. Nelse if (document.layers){
5 M* o& w0 x! P0 B5 }if (ns_marquee.left>(actualwidth*(-1)+8))
& }3 w$ @! N! l) v2 ans_marquee.left-=copyspeed
8 L7 U( e6 E. s" i7 helse) I; [+ p# c2 ^# c( U
ns_marquee.left=marqueewidth+8
, `. a) p9 z& B3 z& t}
, E4 @1 u6 O% [1 m( t! k4 C, N0 Q}
  X) h! Y7 Y+ T' q* X1 |) H' v' |  `% x8 ^. r' G" A! s/ I9 h
if (iedom||document.layers){* L9 K7 {# o  i: Z$ l  b- }  r
with (document){2 A$ \/ c9 S; a/ v: N/ f
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
) C- `) Y1 g+ }; O, H, Pif (iedom){& A1 ]% f0 F2 U$ O, |
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')6 ]% B, Z0 u" a9 P$ ]* Q: l
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
  i* J& i& m! h  {write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')$ d: {/ Z4 I- g, [) D- y2 U
write('</div>')0 ?% B% M; x- ~9 R  L$ @
}2 `& \3 z3 s8 v- X" [
else if (document.layers){
! Z! D" K& D/ L) E) g  n! ]write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
. B2 Y* c1 h# ?' bwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'), j# t* o3 O' p  Q3 @. ^4 d9 C
write('</ilayer>'): z, p5 T, v1 [& z# q
}, R6 K7 E* q0 P
document.write('</td></table>')
0 l! h* Q: C" I8 }; }3 o0 _: x. b}
' Y3 O( ^! a( r, z6 p) N}' r& |+ Q! D4 u* z: G- r5 g
</script>

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