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

|
网页之跑马灯文字特效
//修改宽度
" L" _# T4 E$ Y$ ]1 \7 |/ |! }var marqueewidth=300
3 s0 [2 B6 A, U b//高度! Z9 P5 G6 f8 d6 `, j
var marqueeheight=25
8 U" r/ a" \9 h//速度(1-10)
4 M. L/ z- ^9 P% E: r/ svar marqueespeed=3
5 T$ K8 p+ U8 j//背景颜色
6 ?: o6 ~( X$ B, B- x4 B; Evar marqueebgcolor="#FFFFFF"
K; V+ b9 E* I0 k9 o/ f: ]: B//是否能暂停 (0=no. 1=yes)?
+ ]5 j$ J. l" B0 i: n: s- p) l( P# Ovar pauseit=1/ {/ j7 g! Y% O8 p3 W
6 I' X" }' N; I: L- x! m# w( L& _//修改显示内容4 t5 I" U7 |3 x/ ^7 `
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>') v, P# T4 \* Z* ]$ ~
, r0 }1 I% `$ M
: z+ O f8 E" j( M% E- F* }0 ]
////下面不需改变////////////
7 n% y! ~: x/ D' o' P; ?* i; y* ^0 D H: ?/ s! @" c
var copyspeed=marqueespeed
& B$ c6 Y$ c8 t3 Ovar pausespeed=(pauseit==0)? copyspeed: 0& L, q4 d1 V! k
var iedom=document.all||document.getElementById5 {+ |4 M, y: S8 o
if (iedom)
/ n( @' _- }) z' U3 |) l9 [" Odocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
/ ]0 Q% f) |+ F4 I' f* ^# n) }var actualwidth=''
' a7 ]- e+ y3 Kvar cross_marquee, ns_marquee
7 ]: J, I' c( [
. Q, |/ n: T( d! C/ c. Q: Wfunction populate(){7 E0 ^2 g& r% J( p9 _! X* q
if (iedom){
' f/ c( m; |* U' ^7 ?* _* ]cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
& P0 ?+ _( L; }. ccross_marquee.style.left=marqueewidth+8% X6 D1 K1 h) d Z* y$ h
cross_marquee.innerHTML=marqueecontent8 I% y! d- A# m$ @
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth# p* B/ W; U G% M# P
}
6 Y/ r5 P: \7 B: T; melse if (document.layers){4 O# E6 t( o* s" g% r
ns_marquee=document.ns_marquee.document.ns_marquee2) ` E9 C$ E% J$ F0 v. Q t
ns_marquee.left=marqueewidth+8
% s3 V6 _# o2 S! E$ a- F0 u* V a! Kns_marquee.document.write(marqueecontent)
3 ?+ n6 K+ a" Z h7 `$ Nns_marquee.document.close()
/ y! N6 e; L5 I' q! w8 lactualwidth=ns_marquee.document.width
0 C* P1 D; y4 ? G; q t% l) k}) `* {2 f4 c% U- n) H# B
lefttime=setInterval("scrollmarquee()",20)% [* e2 t# ?2 ?) C" u' h' N8 g6 h
}' m! U) r3 E. }4 @5 e9 g7 v
window.onload=populate
5 K t. D0 t7 @" k& a' w
! Y: H- X1 G! l! s. `; bfunction scrollmarquee(){0 {, \5 P4 P! a3 e
if (iedom){' v2 M' e4 O* T- a7 V" C
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
2 L! f, ]) a" L. f7 \4 wcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed& p( Y5 ]0 q- X- r$ _6 H
else7 m: W# X5 b) F7 x3 F3 o2 ?; b9 X
cross_marquee.style.left=marqueewidth+8
: O* z& Y8 j2 p! S- {! J$ V3 t+ R& |
}
+ A( x# Q; u. Zelse if (document.layers){/ B4 V* E5 v1 r9 N& o4 w4 D
if (ns_marquee.left>(actualwidth*(-1)+8))
3 K/ Q* L4 o2 @" E) gns_marquee.left-=copyspeed8 d6 G2 i5 T2 q m
else! n! `" O' A* a/ V/ u( t1 G; I
ns_marquee.left=marqueewidth+85 b; w$ u, ?3 ?# @
}$ T/ i" m7 C# l, `
}: O0 Q- q' h5 y, `% L1 ~5 L
# ?, \( i- a( M. M4 {if (iedom||document.layers){. a9 f9 v- ^" N% T% ~3 \3 y+ l Q
with (document){7 ` s b3 Q4 J- _: u1 a. T
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
9 L2 C* L; [5 N2 `( M1 oif (iedom){, D2 p" N. _" `) ~4 z% Y
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')' p$ w8 ~5 f0 I l
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
f4 ?3 X2 j; ^9 k' s0 f: nwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')# }3 x3 N/ O6 T) K1 W' Q
write('</div>')& W5 ]7 M9 L4 R1 H5 U$ k, u
}
( ~2 a+ a6 s7 v0 h, s( k* \% H1 Lelse if (document.layers){
- f) Y9 v L& O! `+ ywrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')' [. ?3 F6 @9 h0 P
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
, p; }- P& t4 ywrite('</ilayer>')+ M* N( J' B, @( m$ ?6 c) V8 P5 z8 r: P
}
S' l9 h/ q* d S( Idocument.write('</td></table>')" p4 c& K4 }" B v, f3 {- n
}7 H5 j3 E6 ^5 ]5 ?1 x: h
}9 l: x9 |: ]. D9 t
</script> |
|