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

|
网页之跑马灯文字特效
//修改宽度; c$ m6 e8 R2 Y/ l
var marqueewidth=300
3 l' x* F5 J9 w2 D S//高度( D; ]- x( J# Q
var marqueeheight=25( }+ n* b! ~: r* J6 R6 j* f S! p
//速度(1-10)
1 Y: D: ^1 U4 x3 q3 q, M" U) W* Hvar marqueespeed=3
3 M8 Q0 {' w0 G6 c% K' i }3 b//背景颜色
! k9 _9 ]' a( J- O3 R. r# |var marqueebgcolor="#FFFFFF"
% u k# e1 b7 u. J, V. t//是否能暂停 (0=no. 1=yes)?
& Y) C0 |- ]8 R- Y2 y$ |var pauseit=1# F/ }$ L9 l: B w
4 p) D8 q' t; r: Y5 Z/ h0 ~1 q/ ~
//修改显示内容
% v3 t9 {. I5 d1 ovar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'- l1 ]3 H% r R( V b3 |& f5 P
* `2 h3 t$ n5 k( |5 o
; x: S3 V1 s5 z////下面不需改变////////////
5 V. i! a% ^. y r$ r* O* H5 I0 ~ l% ~) g1 {- t
var copyspeed=marqueespeed$ H6 c, p9 z e6 i
var pausespeed=(pauseit==0)? copyspeed: 0/ f7 V! J. Y, y4 l
var iedom=document.all||document.getElementById g6 A4 j& s! |3 ?/ t8 Z
if (iedom)9 s/ ]2 f+ ~& u' r
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')& S1 S5 m9 y" b& | R* G9 e6 Z
var actualwidth=''
( r J0 h8 _0 X8 ]var cross_marquee, ns_marquee
4 d7 H2 s( X2 V0 b
* W% U4 b- C" Wfunction populate(){3 k8 J. ?9 R& K" i) {+ g2 e1 u: B
if (iedom){
; m2 \1 G5 i4 [1 B" lcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
6 y8 q9 N! _/ J- Pcross_marquee.style.left=marqueewidth+8
8 a8 j8 T( G( m1 T* B9 l4 y0 Ycross_marquee.innerHTML=marqueecontent
6 P) R9 ^, f7 U) iactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth. p% z% w' M K
}
# k0 P% e7 ?1 Z. B7 e) Y* _else if (document.layers){
; G) F4 ?6 Y8 b: cns_marquee=document.ns_marquee.document.ns_marquee2
" p1 E% G$ `) Kns_marquee.left=marqueewidth+8+ Q- {8 t8 K# x/ l: c7 E
ns_marquee.document.write(marqueecontent)
5 C$ }; g& j0 _ns_marquee.document.close()
6 l# t! a7 p' [+ q& d2 wactualwidth=ns_marquee.document.width
5 h" U$ E+ D! G* o0 u' l}8 m+ {) ]. g3 R" Y ]
lefttime=setInterval("scrollmarquee()",20)1 R% }% i p- o$ x( W' v) T$ u+ b
}$ u% A9 a* ~, u! |/ `* a
window.onload=populate/ y3 V6 @+ E) a2 r( S
- l3 B8 |& S g9 ^function scrollmarquee(){+ d7 t% t) y8 L4 T4 H1 o6 Z3 G
if (iedom){
" {$ X$ `6 h1 @+ a' D, B, |if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))% G6 Q+ w. {' {; m; d9 u" z
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
" x+ w' w) }0 n% o8 eelse
! o& F; Y: ?& c0 Xcross_marquee.style.left=marqueewidth+8
( ]4 Q+ v& S% ~/ j; M" C* c
/ }0 b0 G" K- M; w5 @}
9 ^" r9 \) X; f: A3 t1 `& Belse if (document.layers){3 @$ N' b6 l% n* I, d9 S2 Y
if (ns_marquee.left>(actualwidth*(-1)+8))
3 Z+ V' F! k1 h B+ hns_marquee.left-=copyspeed
% @& J: u3 y3 d. o' o' Ielse
3 x1 w2 E0 h% gns_marquee.left=marqueewidth+83 }) O: J1 k* L1 O
}
! X+ [! j1 P, g7 d}% `% X- a9 p) t) Y5 N) C
, [' }; J3 `+ s( B8 y1 pif (iedom||document.layers){' \/ g1 E& y) A& E
with (document){
' m, h- Z; T% j$ i M+ rdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
, \' O# K- }1 P5 q4 l! rif (iedom){
+ \! A+ ]% C# j/ _% U' u; wwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
; m8 t7 F2 R* R% \write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
. Q; F' `7 l5 z/ w) s8 Mwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
" n# F1 o# {* G- l+ j0 wwrite('</div>')" [) f* X4 z, K7 J' n# }
}
- Q& O0 w* s+ e: z( zelse if (document.layers){: l$ d2 \. m! m9 d( U, t
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')" M% G- h% Z' ~$ S" m! k0 D7 K
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')* E1 s, \: ?9 j4 K p# D
write('</ilayer>')3 j8 Y; V* G: Z2 f, Z' ]! z/ G
}7 v+ G, m& K8 }0 j
document.write('</td></table>')# W- y) R4 D' i' j! v+ B
}
6 K* K$ O7 W e}
+ V% j) J9 Y( d/ ?! v</script> |
|