返回列表 发帖

网页之跑马灯文字特效

//修改宽度
+ K% E7 o* f! I& Mvar marqueewidth=300+ w  s# h4 Y/ X0 r5 V& ~' t1 p
//高度
. R+ ]& z4 c* b" K" Z0 ]var marqueeheight=25: `. ]. G0 |  s0 ^
//速度(1-10)
" U% I) c% c) m8 b2 Uvar marqueespeed=3
, z4 y  l% j; k5 F7 Y//背景颜色
0 M; H5 c  [3 Z1 ^( z5 A0 dvar marqueebgcolor="#FFFFFF"
' S3 O/ \6 f- B& y//是否能暂停 (0=no. 1=yes)?
) ~* I0 @( E/ x; [/ U4 X. Y8 F/ V. nvar pauseit=10 g2 F, E1 h6 `: P' R4 t4 O

8 A: u0 ~, z2 c2 G/ h7 H//修改显示内容
/ }: N3 p3 D" ]6 ~* }+ kvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
- i. ^8 g& Y- u& S* j
+ x6 B. ?7 `" l3 A- j8 C5 z2 U
4 `& G/ {& [; Q7 B2 X9 `' S////下面不需改变////////////
: |; r" |% c3 n
1 [* m! N; x  [3 P* b* w: Pvar copyspeed=marqueespeed
  y# @( S9 t- @% }var pausespeed=(pauseit==0)? copyspeed: 0
+ ^/ i% \2 F6 z# Fvar iedom=document.all||document.getElementById
$ N" h: U% [. O+ Y+ Z' |if (iedom)
* x# w5 m* F% [% a' z6 wdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
& F: x* P% g% G7 h5 ?3 Z+ U+ uvar actualwidth=''
3 V3 r. d) s' [var cross_marquee, ns_marquee
! F0 z. x9 h: M5 g$ p: |$ F
7 |5 y) F+ T3 b* ~. vfunction populate(){; U5 P8 z& ?4 @
if (iedom){) P1 R' ]/ o% H( x, x% L
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee" q$ Y$ d3 }8 T8 u5 v( v8 r6 t
cross_marquee.style.left=marqueewidth+8
- {) J7 m& Q# w% @- W. vcross_marquee.innerHTML=marqueecontent. o7 m  A) a- ~) Z. M
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth) g  [& c9 r+ ^2 K" K* @
}7 U2 |0 h1 a1 m; z* [
else if (document.layers){
* e+ t" @( Z7 b. Rns_marquee=document.ns_marquee.document.ns_marquee2
5 d9 J0 O4 u6 k2 \9 Fns_marquee.left=marqueewidth+8
* x) ~+ |& J# K/ |, U# Bns_marquee.document.write(marqueecontent)$ T5 O+ b3 F" D; [. t
ns_marquee.document.close()
  [  Y) p) E& C  ]8 Aactualwidth=ns_marquee.document.width" ~$ G2 t: r; p) M4 i
}; ]8 M% T& r0 T" N
lefttime=setInterval("scrollmarquee()",20)
4 t5 z7 q5 p  K5 L7 P}
1 i# J) r: r. t8 c8 c/ z" V9 _window.onload=populate' X: Q5 \9 o8 `: G& F" m7 o
. ^2 Z) r  n* {4 G3 m# Y( N
function scrollmarquee(){9 e% K( W1 J- ?' U
if (iedom){
: A! x( G' v5 S4 l( I/ bif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
: L6 A1 h. H, o. e& {cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
2 Z  C8 f3 v" F0 a, \2 K* Gelse6 e2 }& F; }. B- V* Y4 s
cross_marquee.style.left=marqueewidth+84 h+ z2 U* \5 K& S. E

$ F! ?/ X1 r5 U1 ]4 O8 A2 a}
/ c' W. {7 n$ K, @) a) r9 ?else if (document.layers){
) }. h0 y4 M; Q# G/ C. O6 ^) Tif (ns_marquee.left>(actualwidth*(-1)+8))  ]/ \6 ^$ c4 K  p' e" q8 T
ns_marquee.left-=copyspeed7 r2 \9 b) y2 y2 t% g8 D* J8 `0 M
else
6 u4 H3 F/ O. Lns_marquee.left=marqueewidth+8
1 s' Z! @* i+ q! ~}
- M+ `: V" z$ C: S" Y& e}( b% j: Q) B' \. Z* {/ j

8 m  k* K; B6 D# \5 dif (iedom||document.layers){
2 Q; j. a" p6 W: E- \" h# y2 ewith (document){
- n3 f1 i; Y* U& L# {% ?) B6 Ndocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
# N; q) \# u8 Uif (iedom){
, G6 R2 b- m- D7 ~4 m8 awrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
7 k9 V; R, z+ U' W3 |write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')& m( F" o+ ?5 U, ?5 _
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
" I4 b9 s2 y  V  P4 ?7 \write('</div>'); c0 f( v& M# h0 d# a1 r
}. I+ b0 ~% C4 H( s, r" A
else if (document.layers){5 o  F8 q# D4 M$ T- F
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
- r; B0 e, a1 O4 |0 ]write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')0 ?5 f, O9 W, l7 ]
write('</ilayer>'); m* o/ K. ~* W+ Z, W/ @, s
}
) \$ p/ J" E# I; K, d* S) fdocument.write('</td></table>')
- \0 J, ^: E+ L$ g! `3 }4 x}
9 @# M$ \" P' s- L! L}
: {0 J, v; t8 y8 J( X0 y</script>

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