返回列表 发帖

网页之跑马灯文字特效

//修改宽度* _/ h' P; I' c) w) S! X8 ~
var marqueewidth=300# t# v; o0 i& n5 b2 d  Q
//高度6 V6 x) E* ]( e1 Q
var marqueeheight=25: L; ?9 T; @8 Q0 P& c+ |6 f
//速度(1-10)
; i3 z+ D* k) U) T3 ovar marqueespeed=3; i/ A+ N$ r0 O* J4 ~- z
//背景颜色
6 {3 ]6 ~. Z4 H7 }! n" A, ivar marqueebgcolor="#FFFFFF"
  s' Z% d) F" j, v& i: ~//是否能暂停 (0=no. 1=yes)?
: P- _3 Z; O: t# U8 e! |+ L% ?var pauseit=1
& Q: Z3 U2 ~" K1 v9 Y( \% n( e2 W4 u8 U6 [1 u2 u
//修改显示内容
. ?4 b# y  N, L- M% avar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'% H" b( y6 @, L& {# I# r

5 D; J* L" R1 \% z- j' A8 L& c: r* [- q! k# v8 ]  k/ i
////下面不需改变////////////
8 E3 O* V7 F5 k7 c+ c  _3 e, S7 ~
var copyspeed=marqueespeed0 M4 ^* n0 B7 ~, Z( r7 a0 _& E8 U
var pausespeed=(pauseit==0)? copyspeed: 0$ N! R5 A5 g1 }& C  @8 H' |3 R
var iedom=document.all||document.getElementById8 k6 G( C1 }+ Y3 Y: ^! y
if (iedom)
7 a; v4 E8 h" ^1 A4 @document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
! c; b" [% _9 A4 w' z4 C! mvar actualwidth=''
2 [- D7 t1 g# `9 ^var cross_marquee, ns_marquee7 y% M4 t' x  h

8 K5 Z+ {1 U5 L& tfunction populate(){
2 v$ h4 y  T% \0 Lif (iedom){5 b0 ]+ b, K+ y. a
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee- v$ |" z& O3 q+ ^) N' }# ]: s
cross_marquee.style.left=marqueewidth+8$ D1 W' u3 s8 Y- Z* [1 u
cross_marquee.innerHTML=marqueecontent: N" I  V  a: ~, s# V" f$ ~
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth0 ]8 o* M1 m3 i
}
$ R8 y' `/ J( ]4 }& A7 yelse if (document.layers){- b+ x5 l. b: g8 `! v3 ]
ns_marquee=document.ns_marquee.document.ns_marquee2' |4 y! T2 v- b8 L
ns_marquee.left=marqueewidth+8; a/ m) A% h! s0 ~. y. V" s
ns_marquee.document.write(marqueecontent)
0 u" T5 g: M* T8 U! O, cns_marquee.document.close()6 G( w: {: y" j- s9 Q8 e4 k
actualwidth=ns_marquee.document.width
- ?9 R" k1 u- ~  Z}
8 w; E4 _6 M+ U; Dlefttime=setInterval("scrollmarquee()",20)
3 G! Y8 w4 y% v! U" Q3 ]}5 q9 R9 y& C2 k( E' a3 M
window.onload=populate0 j  S% S( u& k7 c# j3 E" A# A
5 B2 H/ C- n8 {! w* i, p8 Q3 X2 x
function scrollmarquee(){5 m4 ^. m& g7 x) h9 J
if (iedom){
0 Y6 P/ y6 S8 ?5 H! e- ^6 Xif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
) ~; H& T; {5 r4 i& l6 _/ h% P$ ]cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
" S$ L) @, r% V9 Z8 F" Oelse0 D, R: f1 ], T2 H6 ]
cross_marquee.style.left=marqueewidth+8
; X% t& g9 e" ?3 ]) D& m6 G) \: m# h. u- n: S6 _* t+ F; w2 m3 T
}8 W; ]3 u0 B6 i! p. B% i
else if (document.layers){
5 ?& K! ]+ B% }0 Qif (ns_marquee.left>(actualwidth*(-1)+8))' Z0 K+ p. E2 @& U* {
ns_marquee.left-=copyspeed* d) ]% O$ C4 i
else
3 b* d3 Q1 K0 x2 ^ns_marquee.left=marqueewidth+8
1 \3 Q) }# Q* q1 \9 n}
$ ^# q: p% M8 |0 X! l# }. B}
$ H5 u2 G7 I8 p! I7 U( h
" q/ n  S* C8 _' w: Aif (iedom||document.layers){1 [# j" C! u. a* H, E
with (document){
/ N" o. p& |& ddocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
. B& o$ u! f# P6 d, M5 Zif (iedom){
2 K- o6 _: |  m8 `: l, Fwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
5 {. O# Z! j1 n, I! j0 O: G, Twrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')# G# q6 H- j- a3 s
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')! n7 z/ F6 |- z
write('</div>')
4 Z) b- F2 b3 s}. a: D& d+ M9 q$ J& U
else if (document.layers){
( |: Y4 v4 H9 {& i7 S' H; Lwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'): r! M- K+ T: E4 h. t
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')  s, d- r, Q. t! y" l
write('</ilayer>')
3 q& A  z) c: k: q% i, y: Y- e+ C}, S. v1 M+ x4 f# p% D7 I
document.write('</td></table>')
. \( r& N% y: [- K8 _$ X}; V6 g5 X2 A2 L. V
}
; O  j. ]+ a+ I3 i$ F</script>

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