|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度. N8 I. Q0 R- R+ ~
var marqueewidth=300
! H8 z2 S9 J2 ?7 K; O//高度" z: v+ K8 U R# X1 h8 f+ [5 O3 b7 S
var marqueeheight=25
) S7 a" m8 F- k2 Q# _5 L* n//速度(1-10)
, j0 h G" U" f+ ?var marqueespeed=3
: g! r8 M# L) R9 u1 u7 F//背景颜色
4 W* ?& ~6 Z4 B$ S0 h2 h0 Tvar marqueebgcolor="#FFFFFF"
3 t) `; d' S# a+ L Z$ g" s. a! ]//是否能暂停 (0=no. 1=yes)?
; z3 n8 a, ~1 Dvar pauseit=1
5 _* V+ p3 C4 H" U. U# u2 H2 M: L# ^) _/ b/ m7 D: u) y6 J
//修改显示内容* c. {2 ?" l& ?3 `% D7 h+ K
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
' v- T8 l" h# Y7 O# x5 t7 C5 K |4 L3 I3 f' i3 o
/ u" o7 ]: B3 l////下面不需改变////////////
3 j+ C6 h: l( X0 }4 w' t
( l3 y5 [* g: B2 Q4 ~5 c1 Wvar copyspeed=marqueespeed' y- u# B: j5 A/ v2 b& W8 l; H
var pausespeed=(pauseit==0)? copyspeed: 09 O Z3 w# n2 e4 ^" t- y+ w
var iedom=document.all||document.getElementById
9 l* _* t7 N( B6 B% P0 zif (iedom)
8 U+ S1 P, o/ A6 Vdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'). H- m& r" H5 ~- l1 O
var actualwidth=''
6 G$ G. @- Z* }: k' j8 |! [" Uvar cross_marquee, ns_marquee
) _% D0 k: [( j5 Q; H# Y1 I9 M& i! T- [+ q% M" S
function populate(){
2 x x. ?; K( Mif (iedom){; l5 A E( z* u
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee4 N8 R$ D$ @% H3 c6 ]
cross_marquee.style.left=marqueewidth+8$ o1 a) h, i* M" }3 U
cross_marquee.innerHTML=marqueecontent& O8 _! {& j( K* H& _1 ?
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
- d2 I1 I9 X+ Y6 Z( E}% r, M* d! I4 ^
else if (document.layers){" [& H s. f! t+ S0 D
ns_marquee=document.ns_marquee.document.ns_marquee2
4 _2 h( c0 l# r! R0 kns_marquee.left=marqueewidth+88 o. S( n8 [) C& C9 k1 V2 ]2 I
ns_marquee.document.write(marqueecontent)/ K7 o Q) L, y
ns_marquee.document.close()
8 j( s3 _ o$ [8 bactualwidth=ns_marquee.document.width J, U7 u4 T. Z% ]5 J/ r( c
}& }/ a: ^1 L; Z+ U, u e
lefttime=setInterval("scrollmarquee()",20)5 e* _+ V2 U) l. o9 B# [( n
}
7 F$ S9 [; z/ M+ u3 ~' ~window.onload=populate( b/ h) i, k7 g( ?( j
# K( U" o% v( v `
function scrollmarquee(){7 O0 p" }- K& {' G' t4 S
if (iedom){
+ a" i( u; i% t" `$ cif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
* l+ Y4 w$ g( V9 b" S1 @cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
: ^( j t) _& d; ]else
' ~) {" y3 q) s3 ~; y Icross_marquee.style.left=marqueewidth+8& ]6 r2 H9 g/ {8 \1 S6 I& S0 b% Y' P
2 t% w3 O* W5 b* B
}
9 C4 l' j3 G. t, s9 \! W& P, gelse if (document.layers){. K3 s1 R. O" i% m1 A
if (ns_marquee.left>(actualwidth*(-1)+8))
8 {% n( O: W6 R& j( kns_marquee.left-=copyspeed
" J- _. K) x6 s1 u$ J1 Yelse
( A. }0 W: l& n. xns_marquee.left=marqueewidth+8
7 Q4 q9 o( v5 p5 b% l6 x} h6 x; _% C2 d* A) A& O; F
}
$ K2 ^. Z5 T; B7 C# U- s/ ]' m ?4 l
if (iedom||document.layers){: B- q; {: b% v$ Y; |( z- U
with (document){
* J% Y, c: n* r, R9 A9 q% @9 ydocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')0 i2 a, z" W! k4 l M9 m6 Y
if (iedom){
! m7 N n, ?2 \ j- V8 V/ Fwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
8 s. ]" v( Q4 t; P, mwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
0 R' O, N7 O6 [* \" h; y3 d _write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
5 s V ~# F% Owrite('</div>')
3 {4 X! s/ d7 s ~! _# n$ d0 _}
' c- z) C' v/ c4 z& }else if (document.layers){
2 y4 h/ V/ ^0 t" v$ W) u5 D( V4 fwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
+ Z! D% N1 N4 W8 Lwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')* {8 h# S5 c* N6 J
write('</ilayer>')
6 k, X! d1 i. r) H- c}
5 W4 c. v- z' C: m3 T, }0 vdocument.write('</td></table>')" d9 \5 f! `: C
}$ G* z) ^- O9 I$ m! [/ M
}
6 x$ p# Q+ R% b) l# X</script> |
|