获得本站免费赞助空间请点这里
返回列表 发帖

网页之跑马灯文字特效

//修改宽度$ ?2 J6 O7 P- K4 x% y3 J
var marqueewidth=300! B9 m3 x" y# G' q! |
//高度
0 \4 _8 I: `" o4 J( Zvar marqueeheight=253 q0 f7 L: \5 l* i
//速度(1-10)
: n3 z  P. m5 i" Wvar marqueespeed=30 e. P+ C0 o# R' Z, X9 k
//背景颜色
( z! t$ a3 d3 L9 b. L. k+ ivar marqueebgcolor="#FFFFFF"
) T+ h4 G( ?9 z5 j8 D( R5 B//是否能暂停 (0=no. 1=yes)?% T  k* c: }3 t$ r( O  ?
var pauseit=1
/ u2 a, C: _  B2 `  |$ f& \2 q7 q6 y8 J; x4 L9 N
//修改显示内容5 e7 W& G: L' |, K3 }( v+ ]
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
0 b+ S- |9 I6 @. }+ l
& t! U8 [! v) t7 E! Y
1 s' ]" j- u) ^, J2 }" A////下面不需改变////////////! J, h6 Y1 _) F1 S) p

9 L2 Q: m- b3 ivar copyspeed=marqueespeed
+ k; j$ ~6 C- x; b$ dvar pausespeed=(pauseit==0)? copyspeed: 02 l( r8 t4 a$ i& W! W, E5 m: I
var iedom=document.all||document.getElementById! b' a+ U: \& U) @3 e9 Z2 i
if (iedom)# `* D# T1 o! s$ m0 A
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
4 z% F% D5 k# }( a9 D8 y" dvar actualwidth=''0 N$ W6 [7 |9 m" K8 w* {( I
var cross_marquee, ns_marquee6 a& V$ r1 x+ Z) u6 a$ I6 `
6 S6 H- f, \0 h
function populate(){6 h6 t, T- {+ l& u' z
if (iedom){# Z( w) M: S6 M$ S0 }1 V3 I
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee  P- Y% e# u0 ]4 C, v, v. _
cross_marquee.style.left=marqueewidth+8
( {8 ]7 N  |  B. `/ [5 [, K; tcross_marquee.innerHTML=marqueecontent9 L5 C- W9 M. @7 Q7 h
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
& b# V) E2 a0 a' V8 W9 R4 `& L; _) {}5 ], h7 s7 T- A" D) \5 J7 c
else if (document.layers){( J. ]9 k7 K  u. ?$ Z
ns_marquee=document.ns_marquee.document.ns_marquee2: ^' @9 _+ p/ \; H3 p5 ~9 U
ns_marquee.left=marqueewidth+8
. U# A" i6 C4 j& C' qns_marquee.document.write(marqueecontent)
2 ?& L  T% M0 T- W) }ns_marquee.document.close()
1 ^. x3 N" R% @' j! e- pactualwidth=ns_marquee.document.width
! X3 B. ~( U8 K3 K, {}
! ^- v, g- k/ P/ \lefttime=setInterval("scrollmarquee()",20)
$ a! I, ~% v: B1 Q! U}
% z( L0 M1 m. E: p$ L1 P+ k- cwindow.onload=populate
, U" |6 L6 Y# O+ A
' h- [& c& j8 k. u  e3 L6 {/ k( Lfunction scrollmarquee(){
- @+ q1 ^  ]; @0 I7 P  Aif (iedom){& i" i# g- ~. c( S) {
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
6 I5 Z1 I) B: i$ M/ q& icross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed0 u  k) T8 W- a! o3 i* e+ T* F) x
else1 S) j' a* q. F/ {& ]1 E
cross_marquee.style.left=marqueewidth+88 T0 v8 K$ G! I! A* L* c: L
0 w6 B9 p: ?: ]  l% j) ^
}+ I9 ~1 m. L4 V( g) V) |
else if (document.layers){
- w$ D' v' y4 i! H" Z- Yif (ns_marquee.left>(actualwidth*(-1)+8))) `+ k% |  S/ d& q1 \
ns_marquee.left-=copyspeed
; c. a* c" g& B+ g' gelse
9 z5 n+ f, p5 K, bns_marquee.left=marqueewidth+8
! s7 E* X+ Z  A. s}. G9 C' k# ^& P$ i7 J0 E$ h# j& h
}
/ X' ~% t! N8 U9 N
7 }5 @; B  K, ?" J9 H. Y) tif (iedom||document.layers){
4 U0 F0 u: H& |9 nwith (document){
# A; a, f' F6 R* E6 f: D6 L7 sdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
& y# U8 {2 G; a, L% ?: Uif (iedom){
& H& B" M3 j, h" c0 ^1 Mwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')+ q$ b' C* S9 Q1 O) E
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
! ]- s3 C. Z! E1 X" M2 H5 @write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
/ L( r, S7 ~8 D+ |- cwrite('</div>')' _2 r" j) `! ^4 S
}
1 \1 [! l, y7 U9 e3 b% _7 b: m2 Z$ c: {else if (document.layers){' I/ N3 O8 d; w2 N$ B
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')7 s9 z/ R# N0 u7 T( z8 z8 r- Z
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
+ J2 k; c$ m3 O" \( f3 o" ~write('</ilayer>')
! X9 X9 m+ w1 I8 H! {5 b}+ S4 |. |; x8 _& v1 C- O
document.write('</td></table>')
, O6 `7 K/ I  L; K9 l}: a! ^1 }7 e/ X0 i7 `# @" J3 Y
}
4 g* ?& E5 i' g2 \. ?# L2 U</script>

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