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

|
网页之跑马灯文字特效
//修改宽度
" l" Z9 {! o7 R$ z& I2 ?! zvar marqueewidth=300
7 Q# V' D' M- V) \" H# x9 I//高度
4 Q% Y1 M0 e* l/ e* F( Uvar marqueeheight=25* P4 A9 M' z; D6 n5 {( W
//速度(1-10)
: i0 F& ?/ O& w9 b+ X+ e! @+ _var marqueespeed=3
0 {; E" x a: e& M" h/ x. L8 |//背景颜色- V# i5 X, I* d7 x. ]$ W
var marqueebgcolor="#FFFFFF"$ N, |; {0 V" U3 P( {/ e. L
//是否能暂停 (0=no. 1=yes)?
/ [2 d# _, G4 W2 {0 avar pauseit=1
/ R' b$ T% ~& T& X
" R3 @$ a0 I* t- ~+ {//修改显示内容
0 c2 v3 ?6 R8 w/ L0 |3 S- @var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'( S+ @ Z5 ?' P. F8 l+ ~
a. T9 H' n# A9 h4 A; \$ ~$ K* T2 V6 b' n3 j
////下面不需改变////////////
! R. R( K' Z1 G4 `' d6 R% }6 Q% [! O9 C
var copyspeed=marqueespeed$ ?8 A. a( R, o/ P$ R
var pausespeed=(pauseit==0)? copyspeed: 0/ O0 z2 i4 R4 R3 I8 X W
var iedom=document.all||document.getElementById
2 _& A8 B% d1 pif (iedom); `* R) `3 A! J
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'). R' X; Y- _$ K' v, y2 U+ F
var actualwidth=''
( n& C: `" K5 y. yvar cross_marquee, ns_marquee
" I' N# R! d/ t: k/ e. X; l" A/ f4 k n5 B! v }& F3 D+ }7 A
function populate(){* c$ x" a: K/ a6 B) v0 `+ c
if (iedom){
* y$ F% D6 X+ w9 @- D% @cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee, _ V) W' A8 d# q. H
cross_marquee.style.left=marqueewidth+8
/ a9 E! @0 u# u2 V* o" a# {cross_marquee.innerHTML=marqueecontent5 Q( w0 g6 \9 R2 T6 g) b
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
, {% O% q b/ f; T7 V7 g* u}
4 t; z4 t; v6 L n# n# Pelse if (document.layers){8 E! R) r& t, V( G& O
ns_marquee=document.ns_marquee.document.ns_marquee2
/ M$ U/ A' R7 Q+ x% p, I. cns_marquee.left=marqueewidth+8+ j2 g+ L# s2 D' q
ns_marquee.document.write(marqueecontent)
5 ]5 l7 _2 C ?5 Y& |9 E9 X Fns_marquee.document.close()
0 ]) I) S% ^: n" }( Qactualwidth=ns_marquee.document.width: {- q0 G7 v$ E) y$ _) c
}$ _0 i2 @+ ]( ?5 @6 e6 l" V: J2 e: g
lefttime=setInterval("scrollmarquee()",20)
) h4 x0 r2 ]+ {& P1 h+ N" Z- y}7 M8 ^, D+ J, m s( Z
window.onload=populate
, q; H+ Z* x; s7 L7 x
F. a! U. k& h, u$ |function scrollmarquee(){
' D D9 l& Y* ]if (iedom){
: ^# I7 H9 P. z: iif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
+ c& U1 x/ {. z+ D" |( ~cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
+ n, S2 S. g: ]: |% V# Belse
$ {; x1 O" ?! m: v. O. e( tcross_marquee.style.left=marqueewidth+8" e& K9 P+ W7 |5 O, a5 |4 _
$ S/ _8 O+ P7 W7 h: ]}, `* ?( U1 X8 u C2 W: s; T
else if (document.layers){
/ _% g2 u9 ?, g$ t( bif (ns_marquee.left>(actualwidth*(-1)+8)). N* E, |7 b+ l! k# w0 ~
ns_marquee.left-=copyspeed
# Z/ {7 M+ a4 {+ e# g/ Kelse' k' d- @# ^8 x& Q' q% r( J o
ns_marquee.left=marqueewidth+86 w4 F0 g' Q" l4 m% M
}4 F& l4 W# C' S/ v+ W U
}: w o& j8 _* n
2 e W% \+ Z8 e2 T
if (iedom||document.layers){0 V! Q/ b2 r3 r, @" p
with (document){
0 [5 k! ^7 u( mdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
2 v z* Q1 H) B* Q+ @5 Kif (iedom){" z a% T1 d+ \. ^0 K9 O, ~7 p
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
+ `4 |) L }; t" \; J$ gwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')6 n+ I4 U. G% V+ l! l5 o- M U
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')7 f! i3 E9 G9 J k! d0 i" A
write('</div>')% q7 j# I6 \6 M3 {. |+ _
}" w# m+ k% @ R$ m4 Q8 z0 F) ]
else if (document.layers){
6 Q' |6 f( \* N, ]4 I; {write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
. s+ k8 q0 l; y m4 ^write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
a6 J# ]2 ]6 F8 Rwrite('</ilayer>')
& X, N) q/ Q$ h8 M9 R4 j8 P6 Z}
2 e' {( i1 L; ?( n! {' Ydocument.write('</td></table>')
9 X e4 G7 i* U}) z7 ]" B+ k( ^( w
}
5 Z1 z6 [4 N2 T( N7 q9 D+ X</script> |
|