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

|
网页之跑马灯文字特效
//修改宽度& v$ A- @7 z- Y
var marqueewidth=300
* x9 H! m( V; t, T+ j//高度9 K/ G0 b0 s6 \, [; H+ C: B: X3 ]
var marqueeheight=25, |$ F. S# y, ?) w4 T* B
//速度(1-10)
/ O3 J5 s8 T( {# v( [0 Fvar marqueespeed=3
# ~, f! C: T1 P, }- U0 c9 a9 l- [//背景颜色
# h" i q# x% t) Y' mvar marqueebgcolor="#FFFFFF"
' ^: N: P2 d/ B$ N/ R/ R//是否能暂停 (0=no. 1=yes)?+ W0 P- {% p: Y* f6 s
var pauseit=1
. f1 ?: Q0 P% t( E S6 v& G) C, K4 p
//修改显示内容
# ]5 ]% M& S5 j( a& \1 m$ J8 Avar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
! i& Z3 {! i' ]! h& s; B) a* R, G; K `' o8 a" @8 [5 g
# p. b5 M. L1 c! s& \
////下面不需改变///////////// c' u, |; `( d/ L0 J6 m
" @" c+ ^( b! K7 I5 K& ^2 P0 F# Cvar copyspeed=marqueespeed
' }/ c0 B9 u& P# l) o' ]& S4 [: I) Uvar pausespeed=(pauseit==0)? copyspeed: 0
1 s' p( U! w! v( Svar iedom=document.all||document.getElementById$ b1 b: Z+ h; L0 ~5 U+ e- y
if (iedom)9 T% E) s7 a" N$ R5 _/ L, `
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')+ G5 F6 w n2 t! I
var actualwidth=''+ k7 H5 V3 ]6 L5 ]5 G1 _
var cross_marquee, ns_marquee+ y7 n+ Y2 ^5 B: a
7 ^% R. q" q3 H- ~' k- I7 l6 Yfunction populate(){
9 D' H8 Z+ Q0 ?0 a5 ~7 [/ ]if (iedom){0 u5 p& _+ I( U# Y) r
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
, Q& l9 T$ J9 |4 }6 ncross_marquee.style.left=marqueewidth+8
# ~% e8 b) ]0 lcross_marquee.innerHTML=marqueecontent
" ~6 s. M2 W0 z# S9 l, _actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth' _& f/ t2 ^0 c" c
}
9 ^) q$ g( u8 w$ n% C& S Uelse if (document.layers){5 i, ]% @+ L9 C9 j1 }- _$ u
ns_marquee=document.ns_marquee.document.ns_marquee2! f( q# u; x; k9 O
ns_marquee.left=marqueewidth+8
. p, G( r( v9 m3 Lns_marquee.document.write(marqueecontent)0 k+ `- {4 q* }; s
ns_marquee.document.close()$ h n1 k5 a- d. P p+ @
actualwidth=ns_marquee.document.width) a% D0 {3 S+ k5 {$ t+ q9 v
}
2 t& E) v+ M% F+ [8 W" Dlefttime=setInterval("scrollmarquee()",20)
4 M' Z) G; s. q' e; d3 [}
; ]' d R) {7 v6 H1 k8 ]window.onload=populate) o9 {6 m6 e) w1 O
! y- n5 {% y/ l4 k' u% ]! `- Q# _( c. t
function scrollmarquee(){
% e0 { X9 I9 I5 dif (iedom){
" K- B* m+ K8 Z6 {9 y- rif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
3 ^6 n1 ~5 x- {+ z: i7 ~cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed) R! b7 N$ x4 ?* S3 v' H
else5 a9 o# y/ m% e' u) C6 |2 S
cross_marquee.style.left=marqueewidth+88 j2 Y$ z' x. D
. m) q, {1 a1 E( N! b. Y8 }
}
! z6 a8 ?' v, L- melse if (document.layers){; g# L" s3 @! A6 \
if (ns_marquee.left>(actualwidth*(-1)+8))
1 D$ x# j: z* A# `9 o( Q) [ns_marquee.left-=copyspeed
2 y1 t; W7 a9 |! n# belse
) U/ X; H: G2 o* s) Qns_marquee.left=marqueewidth+8
# ?0 N$ u( q( g* y9 P4 Y}. J- z# d* S# M2 _! K: E
}* H2 d$ C) S. Y0 `
$ A g3 z+ i# u) W' a uif (iedom||document.layers){3 n9 k) s: ]2 z1 @0 l" P' n
with (document){+ N* f* l3 Y; B/ o& _
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')9 u, S7 F' P4 h7 u0 J. f$ A( e
if (iedom){& m" T7 t. y `5 d
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
5 @+ k" Q7 G _write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
) R V! I' V# U3 P, i( W$ kwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'). e$ _! g- q1 R. ~" k# f
write('</div>')
D; i( H; p# U) t8 h \% [}
) C! x& X- z2 D% U2 \! @else if (document.layers){
$ W5 L, J' d2 y" A# Owrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
& f4 \/ ^) g8 J# S0 x3 ywrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')3 ]4 p5 N& ]+ Y `
write('</ilayer>')& M2 S- g7 Y3 [/ V( V$ [0 b
}0 m# A! Y0 x h) h- F7 F) T" L
document.write('</td></table>')
- Q( y5 b% ^0 @( w# G}2 z8 t# R: I( M/ f8 R$ S& {& ~& Q
}
% E5 |/ S. R! V/ y</script> |
|