返回列表 发帖

网页之跑马灯文字特效

//修改宽度
& D, ?* c; z, E. K" ]var marqueewidth=300
/ y; o7 `$ X+ I! F//高度
. ?0 O# |2 q; fvar marqueeheight=25
2 C9 x, y* |: v& H//速度(1-10)
; s$ M6 _% q. v; x( O0 p4 fvar marqueespeed=3* ]; {. p+ i+ A7 j9 ^' s% N. L
//背景颜色! P& b  Y3 X: m3 o0 H+ A5 g
var marqueebgcolor="#FFFFFF". ]. v1 C8 f6 h
//是否能暂停 (0=no. 1=yes)?( W6 n- k; ~. \0 r% ?5 Q
var pauseit=1
8 v" X( O3 a& r+ H- T
1 K4 z# x, M! W) E) x/ _//修改显示内容' v% }( E* m+ r5 E- M. C  U
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
" ~8 z3 `' H" a  S* F8 _0 @5 V; C
$ F) m8 ?0 z9 W* K6 ^* R# z; _, b) M) A) B3 r* [
////下面不需改变////////////
' E) s! k0 X( {6 w0 ?
7 h$ M  W; G4 \+ Avar copyspeed=marqueespeed
1 r% s0 V. M" D7 W1 S# tvar pausespeed=(pauseit==0)? copyspeed: 0& \( l! {# G' `  k9 d5 v" L$ j0 b
var iedom=document.all||document.getElementById5 b6 Z( P+ o6 u1 I* `" I
if (iedom)
, u6 }/ j  P* t6 u$ {! @9 [document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
5 M  L) ]0 J* J- H7 E1 }5 Cvar actualwidth=''
4 M" x3 X! M9 n# ]. Ivar cross_marquee, ns_marquee
: S. B6 _! e( }0 [0 O; \8 x5 `: ~
/ U5 w: H( c7 \* Qfunction populate(){8 }6 C( ~! g4 q1 ]+ E3 G( h
if (iedom){" ]/ X8 T9 P3 ~
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
+ }3 s3 M, B- S1 i7 n+ K9 B2 r+ z2 Bcross_marquee.style.left=marqueewidth+81 W! F. I/ l2 \6 P+ ]
cross_marquee.innerHTML=marqueecontent2 ~* M- o6 f1 O! R4 j- k8 h
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
( A. u7 v6 R& R}* m3 K  O5 Q' y3 K6 a) x
else if (document.layers){
4 o7 r' R% C! hns_marquee=document.ns_marquee.document.ns_marquee2- U  ^1 l6 q! v' V) D5 k+ |8 F
ns_marquee.left=marqueewidth+84 u! W* s' p  g5 Q' N
ns_marquee.document.write(marqueecontent)
- W+ I( \; Z" X4 d% s; J, g/ H. Cns_marquee.document.close()8 [) K0 d, m6 Q- j# p! O4 v; ^
actualwidth=ns_marquee.document.width
! {0 q8 ^6 t0 B) {5 t}9 Y$ S! R: K9 z  \
lefttime=setInterval("scrollmarquee()",20)
7 p( C. o+ `4 @2 g}
, W  q6 q, M8 o3 d" dwindow.onload=populate& I0 T0 M8 T& `

: s3 G# R4 B. t6 {function scrollmarquee(){7 J6 ^9 y" P, l# ]: F6 S" B
if (iedom){
) x! S3 s/ [/ G: N: C$ H( Gif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))) H) x: A0 ~7 H1 G2 G" ?
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed2 A- J( {' `: x( Q
else
$ F. d( W* O1 S5 [; v3 n( fcross_marquee.style.left=marqueewidth+8; ~1 R+ Y9 T( i+ K8 C/ t+ Y1 m
9 C0 p* @$ e% ?8 V2 p
}" Q' V' |/ T' }6 ^& |: s
else if (document.layers){/ [9 G/ f+ F: u
if (ns_marquee.left>(actualwidth*(-1)+8))
& o( [% J( s2 C" ^) c, j$ hns_marquee.left-=copyspeed
3 x' V, m% [( W6 @else2 D1 ?4 ?+ n2 \
ns_marquee.left=marqueewidth+8) M8 y6 `) f( D
}8 Q* Z; r+ Y! j2 T' A( ^
}9 G' v- n! k! Q- U. S# ^" v
7 [+ C: O" N# L" C! f3 q
if (iedom||document.layers){6 i+ f8 u% k- J' O5 [; d; f. R
with (document){; Z# O& Z/ U( N- B
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')& m" [- r* J/ G* K( x
if (iedom){
. I* S: C0 X4 V0 d1 i4 |: [  a, f: Zwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')1 Y/ k; w9 n( p7 C
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
9 _5 V6 I/ S- Nwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')( S# K# y) Y6 ]1 e7 ^( Y3 s7 c
write('</div>')
# J+ \: B' \: ^}* k6 T4 i2 C2 X8 {
else if (document.layers){
, Z; c! l6 _+ T8 Q2 u1 ]: l1 Qwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
7 i- ~  E& w. V% C/ O- ]$ Uwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
/ H; Y! n/ @* b* [% i8 D3 e* Rwrite('</ilayer>')- _) r& i3 i, |) D/ g+ A
}
) d1 y! {9 S1 Ndocument.write('</td></table>')$ [/ e6 r, z5 S7 J6 I
}# o, `. H# [1 m; {( L: j2 {5 M# q
}
4 |: o  |. Z8 y; L" i8 Z</script>

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