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

|
网页之跑马灯文字特效
//修改宽度# J- g1 K( J/ S
var marqueewidth=300
# J+ l* r2 g+ R4 w, u8 p//高度
3 C" S" h9 \8 [9 C, gvar marqueeheight=253 l7 w; U8 J) s4 {! D' l
//速度(1-10)
3 x4 W8 e$ X1 \. T# P' j+ Vvar marqueespeed=3
7 M9 x( w; n7 Q' @//背景颜色- Y" b$ D3 a4 Z5 i- ~
var marqueebgcolor="#FFFFFF"! P! C8 g. Y% k" n
//是否能暂停 (0=no. 1=yes)?. D( ^& u% e7 [3 p# Q
var pauseit=1( w5 k1 Y7 n) t8 L9 H( X
: U$ B& b3 W% `7 Y. _0 a" m//修改显示内容
1 U8 n \ P& r+ Fvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'- A) v2 y; q6 \- ]
4 C3 P2 o3 U; n5 \
# }# j& @2 D& W0 T3 k////下面不需改变////////////. ?: _6 S% T" S0 g& d4 A
7 }; g9 K- g0 ]3 @- t+ {* Hvar copyspeed=marqueespeed3 `' i- H/ b$ d6 V) A/ k+ t4 Y @ u1 l
var pausespeed=(pauseit==0)? copyspeed: 07 B1 s) `/ J6 U' `, G
var iedom=document.all||document.getElementById- v/ ~& U& z( @1 S8 \4 b5 o& W# f/ t
if (iedom)
. ]' P# |$ ^ @+ Sdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')* q m+ f" G6 p F2 ~
var actualwidth=''
, Y" Q# C6 d0 u; N9 Evar cross_marquee, ns_marquee
: M: _9 U1 \) y5 E8 N
3 f5 j- p( I5 `5 G9 K+ Hfunction populate(){
& Q- X/ @2 d! }! z- X& bif (iedom){' Y& Z. J9 g$ d$ O j3 b
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
+ ]/ ?! K7 Y+ B% R {. Y, ucross_marquee.style.left=marqueewidth+8
K$ X0 l) O; B4 v. Kcross_marquee.innerHTML=marqueecontent
6 m* f6 C9 m* f9 gactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth2 Y6 _" h- `/ I' e# u
}/ e% d4 |4 A) g( M
else if (document.layers){" ?& R( T9 X' h# i; m
ns_marquee=document.ns_marquee.document.ns_marquee2
# g6 V9 E8 p$ W; F; Q9 Fns_marquee.left=marqueewidth+8+ Z( W5 e% a. r/ Y' f
ns_marquee.document.write(marqueecontent)
& P. }, h. h5 a& s" R# Uns_marquee.document.close()' h1 m c" ?3 M+ `
actualwidth=ns_marquee.document.width" M# ^6 g8 C% W1 I3 g
}
0 s0 T: {' D) E& O, f$ Alefttime=setInterval("scrollmarquee()",20)
' e; ~. a5 z4 f! K} |, p% H e9 W, {( b
window.onload=populate
, W( H+ l! r4 J/ o: r( r2 \) y
' p# p& Y. R( p& {# Dfunction scrollmarquee(){
7 O2 k- l! Q" @4 m2 T5 C: i% [if (iedom){
* R. ~7 d. }: k( N" e2 Sif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
6 J1 W; ?( X1 j$ w/ W: i7 N' T' Hcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed: b/ S. @9 o" a1 {6 s
else
" i2 C$ R& l) u' D$ q" y) z( b. K( Ycross_marquee.style.left=marqueewidth+86 g8 S2 D# G6 h! c$ }8 f+ j- L
0 F% Z' S5 Y4 y7 ]* w3 \} q/ L% |4 _* x6 K
else if (document.layers){: d4 x& {& g- Y
if (ns_marquee.left>(actualwidth*(-1)+8))
3 t e) c" y$ A- t) B6 mns_marquee.left-=copyspeed2 N: V8 E* ^* ?8 u
else
: k- h( F) K( }0 d! qns_marquee.left=marqueewidth+8/ ?( X& N9 r4 r# R6 v
}! n6 |, k" h/ u3 I3 A
}- |' K+ z3 j2 S& u7 P: L: I! N
# \; S4 N y" D' Jif (iedom||document.layers){3 Y c! N2 w8 a; L
with (document){1 y0 t; w; Z- Z
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 {. h% ]/ q8 f& |6 m/ D
if (iedom){
' R, n6 K2 E& ^! f. swrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
; Q& U8 F8 M6 j% }write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'): k. {, z5 S1 s4 G
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'); [" v9 \8 q8 Z1 D1 H" C
write('</div>')
1 e" `2 x9 \8 b* T3 N* c! f}) }, q0 G6 a" `/ y5 m. y0 Y1 o3 }2 }
else if (document.layers){* j" I; l8 _- ?6 f
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')0 ^) _( c' e) Q
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')/ ^) d+ X7 |# T& m- o* @% n+ ^0 X
write('</ilayer>')
7 u7 J* r: r# ^' B4 V}
- V9 e- {, s4 v' ndocument.write('</td></table>'), ?. B- \, X' b" T& u
}
( M, p2 n6 R2 R' A- ?! Y}! \( X$ B1 W8 w, G( D0 w
</script> |
|