返回列表 发帖

网页之跑马灯文字特效

//修改宽度! m) I, ~1 u  v
var marqueewidth=300
5 Q/ `3 T% |+ M1 V8 b//高度# \' S2 {$ R" v9 u" X- E: @
var marqueeheight=256 H8 o# M1 W8 B' o$ [. l
//速度(1-10)
- i, b0 ~* T! |3 X. Hvar marqueespeed=38 z  Y4 s% q5 s8 q4 U' U6 Y
//背景颜色3 c7 `+ C/ J6 ?% K# \7 \
var marqueebgcolor="#FFFFFF"3 Y4 ^$ u+ A9 ^3 n, V( M
//是否能暂停 (0=no. 1=yes)?0 N5 B+ R  s/ U! u
var pauseit=1
8 z  z( `5 k- }, [' A: E
/ ^3 _1 j3 W5 X" Q//修改显示内容
; k. C  f6 E, s. D( z4 r/ }* _var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>', V, G, G9 r1 o1 O) O+ a+ C
, p: {7 A- i; J! \( ^% g
: J6 R/ v7 g2 q' X/ \. ]
////下面不需改变////////////
' ~/ Y8 J* a  c1 g. b2 ]" \4 M0 z
2 q0 Q+ M' h" ?% f* p" x1 ~var copyspeed=marqueespeed
/ \" Z* Q$ e/ mvar pausespeed=(pauseit==0)? copyspeed: 0$ b' r( f/ a& p0 x: h' y: s- y$ g
var iedom=document.all||document.getElementById
, [1 \6 s2 H2 B' ]3 `3 k2 Gif (iedom)4 W1 M6 M) O0 j' V" n- e
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'); u+ O1 N5 C# q2 b1 u0 q
var actualwidth=''% E6 b+ G( R* t
var cross_marquee, ns_marquee1 ^1 d5 g% z0 E8 ~% ~
, v# {5 _9 Y/ M- x2 Y  R; L5 j4 n& W1 n
function populate(){
6 N. j, }4 ^+ j1 f& b' Z$ H# e! m" hif (iedom){
' u3 ]) L( {; {6 x% h5 h! Y  Ecross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
* I8 m2 u1 |9 e' x/ }. D- r0 }cross_marquee.style.left=marqueewidth+86 c, D3 x$ W. G, V. I1 `0 m3 W) \8 _3 U
cross_marquee.innerHTML=marqueecontent
8 m# M1 F; b* z3 B# H6 k0 ]# v: `6 `actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth" w; U" t' y' N; P5 W) e" Q
}
: k0 \3 H+ Q$ p/ ?0 c- nelse if (document.layers){8 s* l" Y, e6 I$ x" Q( Q+ I
ns_marquee=document.ns_marquee.document.ns_marquee2
* Y  C  H) i1 s7 H3 L: O, D% D" sns_marquee.left=marqueewidth+8
8 q. V  }+ ~; A* jns_marquee.document.write(marqueecontent)) @& {$ }2 R, U0 V; R/ ]
ns_marquee.document.close()
! ?. S+ g8 A! d# `" Bactualwidth=ns_marquee.document.width# ]5 v% x! L( u9 O, y; A9 R
}
! O9 k- K" \; I: slefttime=setInterval("scrollmarquee()",20)9 r' d  L( a' _& s
}
" g0 T9 M: p4 V" }window.onload=populate* I+ u* b2 E" a! G) U1 d& j8 j1 u+ {
+ u) ~6 s# X7 F, F7 j
function scrollmarquee(){: ]' ~4 F4 h  J0 h. k7 N" I2 m0 V
if (iedom){7 ?# S* m0 o- B9 x
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
; |# M* m* d; o- r7 ocross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
; d! R  B0 [& V8 s* l6 @9 [else+ H5 L* y& z" A$ y
cross_marquee.style.left=marqueewidth+8- N8 M  e4 t" F& d# ^+ W' @

0 h1 `0 p( g9 L7 }8 f' N  `}2 P* `0 A' c) G5 u( A8 X
else if (document.layers){$ R# ~8 `# y: `( V/ t7 x0 G
if (ns_marquee.left>(actualwidth*(-1)+8)); r& y  d( |( S. c) a% [$ h: c
ns_marquee.left-=copyspeed
( j6 Y' ]; |6 {- b# Eelse
' p) `1 k; y& C; Gns_marquee.left=marqueewidth+8
: j9 G2 [+ i: k}
8 n2 u, t6 e6 C* d# z6 E6 [}2 ?+ S) Z/ Q- L+ I/ }% [* A+ N# O

7 h$ E! e2 I# y, }if (iedom||document.layers){( k# \* x3 t5 h1 d
with (document){
* [1 H5 w! X. C; Tdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
: \( z9 J6 R- a( J  T6 N4 f) |if (iedom){- J5 V) P4 c/ o' G  w+ U4 E
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')7 a- g3 E" ~+ ~' j) y& z
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
5 h  _1 G7 T5 @- q! @write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
' z0 J8 z4 P1 [& Y; Awrite('</div>')
* v- G/ M; d" f. S2 \% J}
2 O- n; H3 N5 I5 n( Qelse if (document.layers){+ i) e* ?0 B% V  \& M
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
  u! Z) D6 g$ X* ]6 v8 Cwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
' P. h( V( L4 ^  Y( uwrite('</ilayer>')
: E( S! o9 T! _5 n}/ ~/ a3 r, Y6 X* D
document.write('</td></table>')" b% U8 {" S- }9 Y0 U
}
- S* G% U( V6 N1 \8 {}
$ H3 l+ @$ \' b/ @+ w+ _9 z</script>

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