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

|
网页之跑马灯文字特效
//修改宽度# n3 m$ t- _# ^
var marqueewidth=300+ X- v& R7 a7 F1 b% \! j
//高度- N8 C% \8 m% j2 ~* H+ e7 f
var marqueeheight=25
) Y: }8 g# _2 f u//速度(1-10)$ ]- _3 X7 n* A2 K! b
var marqueespeed=3
9 N5 d0 \- A( A//背景颜色5 H7 @, q. ?7 ?
var marqueebgcolor="#FFFFFF"% A2 ]6 m3 w' m% r8 R
//是否能暂停 (0=no. 1=yes)?
8 f! P* f8 W, k- _& E3 \. rvar pauseit=1
/ c2 H* ]% `9 A$ e! j8 U- Z6 ?3 A8 P8 h9 B3 i' ^% ^# w/ P
//修改显示内容
$ t, y- N- z5 J5 N A1 Qvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
5 v/ o! e& Z3 g! i
( @. c# L4 f( U- w$ S2 ?0 @# c' r) e# p8 N: _+ |
////下面不需改变////////////
& f: }" _4 s6 F
) h2 Q( {- K! \) h9 _! Gvar copyspeed=marqueespeed: f) T1 E0 i Q e6 Z- \) E
var pausespeed=(pauseit==0)? copyspeed: 0
1 Z$ \7 x% n! c! rvar iedom=document.all||document.getElementById
) ]+ R# w$ R' k( H8 c, b0 Mif (iedom)
6 A, T4 g! y `: r odocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
# g' W; |. _$ j- F1 G5 ]& j. Cvar actualwidth=''* s2 A* v4 B s, |+ @! ^1 W2 t5 _
var cross_marquee, ns_marquee
2 ]' K! L. c9 N- d( I" u; P# o2 ] L/ G, Y/ a/ g
function populate(){1 C0 @+ q- [& ~+ j% s
if (iedom){
6 V) P1 i/ J! Vcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
/ v" ^8 Y+ U+ d# S* N5 K& x9 J' R) Tcross_marquee.style.left=marqueewidth+8
& G/ [4 }: {1 r, kcross_marquee.innerHTML=marqueecontent
& }# q4 _5 e' C+ k8 C: factualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
6 V( j* ?3 j& f* o4 A( v}
: Z g# r9 `' o9 u4 Jelse if (document.layers){ @4 y" ^7 Z' O5 ~7 x
ns_marquee=document.ns_marquee.document.ns_marquee2
* T3 f1 P! {; o% S0 g1 _ns_marquee.left=marqueewidth+85 |6 C3 E/ L0 w( u1 [5 X
ns_marquee.document.write(marqueecontent)
1 W$ ?8 V: P% ^ns_marquee.document.close(): f/ }; T) K" f
actualwidth=ns_marquee.document.width b$ A( S* Y. e& j3 S
}
4 z3 L+ ^" G5 d) Slefttime=setInterval("scrollmarquee()",20)
, W( n3 a/ X/ [3 Z- ~( T( \' D}
6 ]" Q% |- z. J7 Vwindow.onload=populate/ M" n% V1 W5 l; \
/ v( }3 _# N9 C# Z9 m
function scrollmarquee(){
* ~: [9 V4 h T% w: n' vif (iedom){
1 {# r- e+ W* bif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
4 Z+ L! O1 ]3 Q: o5 X" e9 H' A$ |cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
$ s: P! p Y5 W$ ^/ q, Telse8 q* c9 T, h4 @8 s7 j! r, d- `
cross_marquee.style.left=marqueewidth+8
* V8 A. i1 C- l+ _. o# O" @, I) m) {3 J1 ^ R9 [ n
}: [) `: x& _+ |+ Z
else if (document.layers){% @5 ]2 o% Q! T4 _; Z% h$ y! z1 `# O
if (ns_marquee.left>(actualwidth*(-1)+8))
2 F* V' Q) l$ K# H1 jns_marquee.left-=copyspeed0 m1 o( `/ x% a( j4 t$ G% E& y
else
1 |# }1 x% S, ^) d6 G$ O6 Gns_marquee.left=marqueewidth+88 B4 f0 y% M' `5 M
}
a$ m! n6 @ N/ h8 [, q7 {( o}
7 B: j6 p' ^' [0 K9 @! X, e! Z, O, Q3 ~. R" o
if (iedom||document.layers){
/ i7 |( u& p* V4 ?7 q, M( ~* B0 Swith (document){
/ z6 n2 y" l: n) ?0 v& gdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')" ?6 u4 V) x: _2 e C
if (iedom){5 r: b6 e7 b% C ^& t. U
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')! M# C( O$ g: |$ B M5 `% F
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
( J& @9 T9 G! k1 j5 w6 `) Ewrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'). ^: a3 j+ a6 V4 J3 Z% r( m! K
write('</div>')6 @; @' C4 O, x l/ b
}$ q2 ?0 K( }0 k) v$ N" d( e" H
else if (document.layers){
' D/ o: Z+ Q( c5 h% Xwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
% D1 Y" @0 T" m0 e$ D$ Uwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
& B0 p: y, N) d8 `( `write('</ilayer>')
% Y' u6 O7 f# c# y- p, q1 J: u- Q}( Q _) n6 [* a5 N! ]
document.write('</td></table>')7 ^( f$ t* w6 i5 y4 B7 Y" j
}0 E$ A, m* g( I* ?
}4 }+ e, b. b' E( t5 Z
</script> |
|