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

|
网页之跑马灯文字特效
//修改宽度9 i/ t: s# O& l/ t* t4 ^1 W* ^
var marqueewidth=300
# E8 J2 C: r$ J5 a% m- Q* }. |( b//高度2 m( V6 w* i' P* m) T/ j
var marqueeheight=252 ^( q+ S, N/ d3 _ ?
//速度(1-10)
: |: n0 `5 a- U! M% j0 d2 x% C7 tvar marqueespeed=37 J' a. h. g) C
//背景颜色
0 ]. J$ J# g* J3 ] Mvar marqueebgcolor="#FFFFFF"
4 ^& l1 V! ~$ C$ ^3 P8 O//是否能暂停 (0=no. 1=yes)?
$ `6 J' c0 B$ ]. N* Q" S6 a2 Lvar pauseit=1$ r8 x3 X( L+ ^% i4 e, Q4 N' L; o
- b3 ?% {9 n& ^2 D; p9 j1 z$ p
//修改显示内容
5 z4 N+ R5 H$ T; lvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
8 M. i0 n6 Z8 t3 U
' ~2 k8 w0 {& L& o$ v* c; C: D1 N, D2 L( g$ N8 @- z
////下面不需改变////////////$ P8 B4 v: G$ G* b/ q
5 n2 p: h' ^( M: D! c K8 }7 J1 W* z1 ^
var copyspeed=marqueespeed
3 L3 Q" V' W6 z3 ]. R3 i6 z2 Ivar pausespeed=(pauseit==0)? copyspeed: 0
; K3 o* J- i) G2 s( e( c) Uvar iedom=document.all||document.getElementById
/ R0 ?; U2 t2 D4 | {+ ?if (iedom)
' `1 D8 T. K# q9 f% }9 [document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
+ L) y/ C* h; G( z; x6 Wvar actualwidth=''
/ E0 @( w. ?: T* q; zvar cross_marquee, ns_marquee
$ v( V0 @# s! a' m' R3 d6 ?+ ]% A. n/ u
function populate(){1 o n( @3 a# [, |8 ]6 D5 r2 \, s
if (iedom){0 v, ^' h7 ^4 E9 h3 d
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee. {$ h. `$ ^, q4 B
cross_marquee.style.left=marqueewidth+8% B7 a. q' P! [7 r+ z& J! I
cross_marquee.innerHTML=marqueecontent _; A3 L2 `* O' X( C
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth' X1 ] `+ B q, g& t0 W9 a
}
6 G' s& J" O$ lelse if (document.layers){
$ {. `5 g/ w% Q/ ens_marquee=document.ns_marquee.document.ns_marquee2
. X: V3 l& y& V& Q, Yns_marquee.left=marqueewidth+8
) ]8 R: F6 ?4 I1 C; J0 i/ ]ns_marquee.document.write(marqueecontent)3 ~% O2 K3 h7 O
ns_marquee.document.close()
# @, f, h. C+ t' W( a+ _* F4 }actualwidth=ns_marquee.document.width
& I7 Y! ?$ Y$ U% ~9 U5 O1 Y: j" |5 Q}
" I0 V) V: j+ I9 t' E2 [' t1 ^lefttime=setInterval("scrollmarquee()",20)+ S6 G* F* i+ K6 y
}
$ Z$ C' @$ I9 r3 N; b7 ]/ fwindow.onload=populate
: e8 ]: \: j3 v6 |- G- h# f' x- z1 }, e, e
function scrollmarquee(){
7 M+ e# f4 g: {) x( e4 gif (iedom){
8 E. K! `$ Q8 ?0 Aif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
3 ?9 }) q; G5 c8 W7 u0 {) I' p8 Ncross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed: H) c6 R* R* N; T" Q, L
else$ n& ` |4 I# s! `* O
cross_marquee.style.left=marqueewidth+8 s- S6 F% M$ U7 W4 R* B/ q
3 R1 `1 h2 p, b' m y
}
E- b9 m) { welse if (document.layers){
. E0 ?( `; e Bif (ns_marquee.left>(actualwidth*(-1)+8))/ T; q+ T, C* \ Q, T& f3 m' l
ns_marquee.left-=copyspeed
) {$ C$ K0 Q+ M* k+ relse
: {* |$ _8 r# J4 y3 y4 Ans_marquee.left=marqueewidth+8
" `' v& C6 L4 @! F9 H' C( [}
3 r, G4 p# s2 W. Q2 E}
8 e* g4 k+ I, m f/ {0 ]" j' H" {( f" u4 `/ g! Z
if (iedom||document.layers){+ P4 w ^+ @ b+ w% y3 \
with (document){
' v& V# H( m0 W; R& u! s0 w: X: rdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')" J8 `3 y- Z1 o+ T7 R3 A5 g
if (iedom){/ H1 k* E5 @4 ^9 ~/ n. p H% S3 d
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
I3 ^8 m4 J vwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')6 u# m7 g' u7 @9 u/ _
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
1 p- R! h& q% p0 o7 owrite('</div>')
& r G5 s, p, h- K5 W- A}/ \6 w5 J9 V6 Q/ i2 A+ G; w
else if (document.layers){
( n' \5 S: b4 Q! _: ^, \9 \0 Twrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
. l# l. V3 H; Y* {write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')) K( k. l+ L$ n, x% w9 i$ P
write('</ilayer>')9 K- K+ U: O# f3 r8 p4 ]% s
}: e7 z7 M- y U; E2 J% Y* p* h
document.write('</td></table>')
! h2 G R# [$ `7 g}8 ~# \2 }- j! e! B7 X) g- Y5 a4 l
}
4 Q4 s6 i$ G4 D: J8 T* a</script> |
|