获得本站免费赞助空间请点这里
返回列表 发帖

网页之跑马灯文字特效

//修改宽度
3 v4 F7 D& C, e# ^. c1 Wvar marqueewidth=300
: F5 d, M5 k3 X. ?2 I: K  o& c//高度6 n" L# L( Q* w; \/ e
var marqueeheight=25) F. V! A3 l% K8 ]9 t/ ^( s2 i
//速度(1-10)
. z, Q% C/ Z7 h/ Q( k. Q5 dvar marqueespeed=3* {0 B! C9 B$ C  {8 i: p0 J' j
//背景颜色
, I: O% i# V6 R. j* avar marqueebgcolor="#FFFFFF"
* o) i6 k7 I3 p3 U# P' T* _0 z5 W" v//是否能暂停 (0=no. 1=yes)?
' g4 P  V/ Y* S5 Dvar pauseit=1
4 s# G6 x! B6 W' u. @0 |/ q9 j+ u; c7 s0 ~
//修改显示内容
5 }" Q7 \  u! y$ r0 c7 Ovar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
( ]3 [+ V& d+ E6 _3 v, l: p- @
5 Y: a  {0 i& ^/ s# I3 \0 P" U" U3 C0 ?! _4 w: q
////下面不需改变////////////
$ {1 W, h6 h. K; {3 g/ Y2 s
9 n% z- C4 g' E) O/ K( w1 |var copyspeed=marqueespeed
, I& E2 x1 ~* d2 E8 x/ m1 J* c! Gvar pausespeed=(pauseit==0)? copyspeed: 02 d' `6 a6 V( p% u' w0 A  @* R2 N
var iedom=document.all||document.getElementById- H6 c! D% a/ {3 R
if (iedom)
% l& t1 ]/ G4 v# a  _: Fdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')' c+ C% H8 ]- J9 t
var actualwidth=''5 ?" j1 ?) V4 Y2 ^" x
var cross_marquee, ns_marquee
+ J/ _  ^+ Z4 k7 Z8 m1 b/ M! d' E7 F/ h) R3 z: X) U  }
function populate(){# f# r1 t- b6 B3 z! Q$ J5 d$ U
if (iedom){, C+ f  v' o0 I) U
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
: @; c+ |0 S- C1 k. J& ~% _cross_marquee.style.left=marqueewidth+8
# }; u9 p) P! p. M4 w1 }- Wcross_marquee.innerHTML=marqueecontent
1 J% v0 y* {& h$ p4 P3 [actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth3 u) P* u  \1 w& ^. i8 [: M$ }
}6 F1 {0 b9 C9 J+ k& B
else if (document.layers){1 B: y4 ]0 O. C% i' M) y
ns_marquee=document.ns_marquee.document.ns_marquee2+ @9 i( E  |3 p- w8 v6 h
ns_marquee.left=marqueewidth+8
/ E7 ~* J! Q3 I! c' Xns_marquee.document.write(marqueecontent)
; e% F0 @4 M* e" ?4 u& Cns_marquee.document.close()) ]( ?" ~7 w- `; ~4 M5 F
actualwidth=ns_marquee.document.width
/ X  s; `# T, T( u- [}/ Y$ h4 o9 m$ A+ m- e) n
lefttime=setInterval("scrollmarquee()",20)
$ S* M, |+ y; @* u, q}  ~% L- c! o6 I- S4 k" ~1 P
window.onload=populate
1 Q% [: M$ o' I5 _1 N, s, I$ b8 ~3 N; p% X  g$ T5 D4 ^
function scrollmarquee(){0 u- a2 X1 m4 Q) c- f! T
if (iedom){# D2 K. e+ g, B- ~
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))  ^& _: t# M8 ]: ?8 G; G6 g2 R
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
$ O( ^* d9 A9 k+ d5 z7 Yelse
1 H9 p1 i# U) ^' Q8 }8 ]+ scross_marquee.style.left=marqueewidth+8
( Q; ~5 D: a( }+ |
+ f" L2 X/ U/ {1 G* z- ?}
& I: \7 X% z( r) h5 Kelse if (document.layers){) @3 e6 W6 G. p& L+ x
if (ns_marquee.left>(actualwidth*(-1)+8))
5 ^/ X" s; m; A; G4 Rns_marquee.left-=copyspeed$ i3 X* s1 |% |8 u1 S7 T
else
7 Q- Q/ z" P/ M+ u3 Pns_marquee.left=marqueewidth+85 z; Q8 ~4 J1 k. p7 S
}
( e% ]' `# ^7 N, h6 I" W; m}
* h. H+ D* Z  G3 b
; s, y6 \* T, `" wif (iedom||document.layers){9 i: V6 p: q0 S/ r' D
with (document){( R4 ~, D" {/ R" w- X  J1 M. f/ B" @" C
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')9 j. T% m4 k" V8 f. r/ ~
if (iedom){
' F+ r+ k1 m9 r3 @2 N1 h9 @5 swrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')4 q7 \- M$ S# G
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')+ ?- e' J( G& H" h' f4 x: {
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
; C5 f. g# n+ u! Ywrite('</div>')6 V* k1 v- {, T
}
( {8 d4 ^0 a9 P5 v0 jelse if (document.layers){
, ?) [9 C3 |  |; a. w( U) h8 {0 awrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')3 Z0 p$ v- w  j
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')$ \. d* |) y1 Y
write('</ilayer>'); g. B4 n7 t* ^+ x2 L
}9 Y8 |0 C. |9 {: {. r  [. u
document.write('</td></table>'): [0 y0 X8 f: \1 r5 t) r1 f6 j
}! Y1 f6 A& h- j. l
}
8 _: x3 w$ M: \</script>

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