返回列表 发帖

网页之跑马灯文字特效

//修改宽度% r( i8 h. n# o7 J. c
var marqueewidth=300( i8 j4 L, I/ ~. X) Q4 [! q. k
//高度
. a9 h; v: `  U4 D. }var marqueeheight=25+ b+ l9 \; Z# h
//速度(1-10)
4 {2 s2 _+ K# {+ X. C, Avar marqueespeed=3
4 |# y1 ?2 X: Q' E//背景颜色
( d; P0 [4 j0 }8 Y4 Ivar marqueebgcolor="#FFFFFF"# Y! {; @8 k0 ?- D9 h' ]! V8 m) O
//是否能暂停 (0=no. 1=yes)?2 J4 \" N) h0 A3 k
var pauseit=1
/ t3 e  }& J& O7 I4 {+ V# V0 F% K9 `+ w' T3 b  n8 I# w7 B
//修改显示内容& `. P* f+ I5 `) c5 w/ I' Q
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
# G9 U, _" B! I# J+ c: F- _' ^) I( v0 _8 o6 H" ~
1 J) U0 r8 _' u3 i5 r' @  ^
////下面不需改变////////////
2 R, f( a( _' \/ H, ^/ d, g" K( T) @6 s
( e* v3 e+ c% @var copyspeed=marqueespeed
- `- v) N. y5 i- W( \$ Cvar pausespeed=(pauseit==0)? copyspeed: 0  {- a5 i: O: U8 S3 G: M
var iedom=document.all||document.getElementById
6 w3 A4 {( ?- N3 eif (iedom)! S4 R. h/ s4 p! [3 s
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
* @7 e; ]# c0 s' q: v% m# v8 xvar actualwidth=''
' O% u" g1 O. d; j3 N* b  @var cross_marquee, ns_marquee
* D6 E1 p8 P$ l6 h: G3 n( u5 Q) \2 a- X; w
function populate(){# J9 p7 o2 K6 Q# Z1 V8 r
if (iedom){0 d  O7 u  V4 P
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
* X. i  E- a% g( mcross_marquee.style.left=marqueewidth+8
1 ]- X% @, C# Zcross_marquee.innerHTML=marqueecontent- j$ U" q* c9 ?8 q& Z; P
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth) J$ H; C3 t& B" b8 X4 G7 D4 ~
}
4 l$ g, D5 R- P$ m9 f) uelse if (document.layers){/ Y7 z# F- c; i7 A/ g% k
ns_marquee=document.ns_marquee.document.ns_marquee2
7 @2 y0 z* C3 }4 J& Pns_marquee.left=marqueewidth+8
5 Y2 w5 o: u! V' g' ons_marquee.document.write(marqueecontent)
" I1 e5 c6 @5 l# K9 Z1 h  J( y$ Dns_marquee.document.close()( w7 Z- S  ~6 v) ^
actualwidth=ns_marquee.document.width
' u4 v: H* k/ G2 J! ~}0 ^+ }7 L% o# y( z' x& p5 t
lefttime=setInterval("scrollmarquee()",20)
+ ?2 m9 Q# ?; |; G* H}3 a) t7 H* E/ b3 f
window.onload=populate
9 ~$ H% _. d* h+ q) v5 F, Q- ~; L( i6 E' q, h8 x
function scrollmarquee(){
- S: i" r4 a# M# D! |- J8 W0 q1 Wif (iedom){
( Q7 z- z! ~7 I2 n& _* ]: I9 C- wif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
5 I. [2 L, ~; Gcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
! e7 H! Y# _  v) relse
' k' x* Q; W2 I0 I3 k$ Dcross_marquee.style.left=marqueewidth+8
& ]* w+ @% O/ _) z( v2 A
# H4 T7 O3 l) e- a4 [}
' I7 I' O2 d8 ?2 K- u- Oelse if (document.layers){
- a; l" q3 o/ Qif (ns_marquee.left>(actualwidth*(-1)+8))% c3 b5 N: N* K* i
ns_marquee.left-=copyspeed
9 Y# n. k4 h% v* O/ I3 d2 t% Helse) v' C4 m7 b" O" v
ns_marquee.left=marqueewidth+8
9 i% z0 o1 Z2 q  }7 A: E# o}! Q. T8 t4 z: k3 g9 h0 T
}% z$ q' o# r- |& f. C4 w$ `% |2 \

* F8 x9 K9 W6 O; E  M4 Rif (iedom||document.layers){
: G- t& w0 o) @with (document){  c& D$ v9 b- d4 Y
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
) i0 v5 P9 z# M4 |5 ?/ d. ~2 T: Fif (iedom){8 p# e" R; T5 C$ R& @2 S. b- u  h# ?
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')) C/ [; m0 P/ O/ L# p
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')$ u7 U. c* Y/ ]1 o1 ?2 G
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')3 I0 Y* i" J% i7 K7 q
write('</div>')& `& p- T3 V) L3 R0 _( c: ^
}
( ^4 o# e8 t' S3 D& S0 c& Aelse if (document.layers){
6 c) R2 D7 C9 }% ?write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
$ A2 a3 E( ~2 `" D5 B" pwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')2 a9 u% A, ]" I
write('</ilayer>')' J- A+ k! ]8 v, a& h, p
}. U8 l8 j- e# V! S0 `% J
document.write('</td></table>')  z5 Y' L) x/ `
}& Z- P" Z: h( Y* |0 R
}
) G# M3 H5 r' n9 Q0 D5 _</script>

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