返回列表 发帖

网页之跑马灯文字特效

//修改宽度
6 `$ |$ G  P% s4 Z0 Cvar marqueewidth=300
& Z% g- m0 h" a$ Y/ x//高度- {  A! ~+ w" _& G! `' e) H! }# r: w
var marqueeheight=25+ D4 E, r; G( g1 M1 W
//速度(1-10); e  q' ?5 x& Y$ w- \4 Z' k
var marqueespeed=31 |4 Z+ K. s( ?: L! B0 l+ F1 O2 ?
//背景颜色* L' h" y; J% i- Z
var marqueebgcolor="#FFFFFF"  w- D6 L5 S0 `' K( Q7 D8 E
//是否能暂停 (0=no. 1=yes)?3 Y9 Q6 z* u$ e
var pauseit=1
, V0 l- _4 Y9 a% L% X4 |3 i, k, w/ h( |* a$ B7 d' m6 Q% v- b; `
//修改显示内容; J8 i! _4 P- M0 _( l1 G
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
! F$ c* m( L3 g( G, I- n3 m0 D/ P, g" h. {6 J- H0 v& V  {$ u$ [& v

# T7 V+ I: X& e- |////下面不需改变////////////* ?' c" D$ w' J

9 k) j/ z. Q) T" Y; g0 q4 @! ivar copyspeed=marqueespeed0 c, ^/ H6 f  G3 L0 h* Z( G
var pausespeed=(pauseit==0)? copyspeed: 0: j2 M* v. Q, N8 K$ V; e" w5 ^& g
var iedom=document.all||document.getElementById; V- P) D, R' ]! b! C9 D
if (iedom)
! j  H  j$ Q4 s. f; Ldocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
" t8 i# A  R2 Z! |# `" @' vvar actualwidth=''
$ }$ B& F" H8 ^+ L3 @( Evar cross_marquee, ns_marquee4 E/ \8 N8 L( C0 \; z7 }9 n# @& T
$ i- S5 i, k+ R4 L) t
function populate(){! `. ?7 m- E4 v
if (iedom){
( ?4 Q7 d+ k& B' x  P8 `cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
& v+ m6 Q8 R. \% F- D2 I5 Kcross_marquee.style.left=marqueewidth+8- @+ o4 Q' ?, j) ?. ^4 C
cross_marquee.innerHTML=marqueecontent
3 S& C- i' f( y: c% ]5 J1 {6 v( wactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth! i# ]4 [2 X7 o: d2 U9 F* @
}
. W. Q" m: ^9 T! a2 Oelse if (document.layers){6 O! w+ z) ^3 s' S
ns_marquee=document.ns_marquee.document.ns_marquee24 g2 e1 b( s- N9 A# \
ns_marquee.left=marqueewidth+8/ u, P% i9 I9 v1 P, i
ns_marquee.document.write(marqueecontent)
: }# B3 l) i" {ns_marquee.document.close()6 g( o4 Q8 c: S9 ]& M
actualwidth=ns_marquee.document.width6 h0 V( [: T$ U& ?
}
% p- }5 p/ c4 B/ G. nlefttime=setInterval("scrollmarquee()",20)
1 |# S  u6 N6 r6 o$ h; N}
+ W  Z/ j3 X, D5 Kwindow.onload=populate* M6 P5 Z5 t( e5 v- t! U/ M' G
: M" u! C  [. B; Z) v, `
function scrollmarquee(){# H% O5 W2 B8 T( v, g8 |( Z+ K
if (iedom){( y) F, `* k2 K' n% f
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
. t+ y( s$ e! X" B( b1 D; j9 Vcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
1 Q2 B/ _/ I/ s/ melse2 [) R, W0 S" D2 ^/ k3 Q
cross_marquee.style.left=marqueewidth+8
9 }2 _" k# V8 m- a7 U( X6 z
3 Y& s8 H3 r: c  e/ t9 f) C4 T5 A7 E0 x}% [& ^) l# D+ ?8 n
else if (document.layers){
8 [8 m; L5 ^* c7 ]7 ]8 g& yif (ns_marquee.left>(actualwidth*(-1)+8)), b' s6 t: v, [, G$ d& G
ns_marquee.left-=copyspeed* O& B8 p' R  S* p" P/ K  J
else
9 I9 h5 Z) Z; V5 ~* ^8 j2 Qns_marquee.left=marqueewidth+8
( l* {; p; T5 ?}
/ z- b& m% M9 T- x: V: I}
. n0 D; _  k/ O; E& u( G5 p6 ~* l) F
if (iedom||document.layers){
5 B5 [/ c5 M/ V! |with (document){2 t, f- B5 \2 I& Q/ N3 w
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')6 n* N; Q- Z% ^& D8 ]7 N7 M
if (iedom){
/ _& a$ d+ p' s5 C8 Ewrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')" M* w, j* z; D$ f% d- G! s, i7 U" L
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
1 V$ m$ z' @: E: @3 a; dwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
- @% V0 g" o3 xwrite('</div>'), ]) E' {  r. R8 g6 `, j
}, M7 |4 O* |, k
else if (document.layers){7 w2 O& r% u$ A" z8 R% x. T/ k
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'); ]5 Q7 ~9 E+ `: t# @
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
: f: J' j* m2 y( |0 ~/ C; L, c2 Gwrite('</ilayer>')* D: \; i- N) A
}
; {) Q8 z( O4 h. J- G. ]document.write('</td></table>')
5 [9 a5 A  h& ^: x2 l}
. e# u( Q2 _3 M6 _}- z2 U7 ^# I& o3 n# m. [
</script>

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