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

|
网页之跑马灯文字特效
//修改宽度
! F; p. Q) \7 x! Ivar marqueewidth=300
& _4 Z9 g" ]/ \" u//高度
7 q4 @( L; b L5 hvar marqueeheight=25
" F% t8 a; P4 g+ o//速度(1-10)
7 z! o0 ^/ U) xvar marqueespeed=32 g4 P8 i8 V6 x A. E2 ^! Y* i
//背景颜色: b. e, r( x8 n
var marqueebgcolor="#FFFFFF"
8 k' r; p$ A+ M: b4 L//是否能暂停 (0=no. 1=yes)?& b- M, S% n5 J6 r( X2 T, ? d
var pauseit=1
* O/ R- z8 J! | o2 U t- A K) w% e' `, A7 z# V0 V
//修改显示内容. v/ O1 d: c; O8 [0 @
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
0 s- `6 p5 U) W6 ^: b1 j) T! H3 H+ r+ V0 q
7 |% U; @9 W& O+ Y, t////下面不需改变////////////' ?- Y) |! W# ?4 n6 r' S
8 V3 S& T: c* Ovar copyspeed=marqueespeed) n. e2 w( Z' H9 n
var pausespeed=(pauseit==0)? copyspeed: 0" ]0 ^6 t+ o% m' z
var iedom=document.all||document.getElementById8 J$ J* r9 W; [. o
if (iedom)
" B# O Y' ]7 D) v4 Vdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')$ D& z; C# |6 U
var actualwidth=''
1 p% t% f! p: C/ e/ tvar cross_marquee, ns_marquee2 `6 G b- [3 E) O4 Q% S
( y5 H. {4 V4 B0 I4 P1 Z9 `/ m
function populate(){
- h# W' Y1 _" ~$ Jif (iedom){
8 I2 _1 F5 d: S+ J( W' J; u" zcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
" z4 R5 Y8 [$ [* n+ ]/ Zcross_marquee.style.left=marqueewidth+82 D/ \8 D8 o+ u0 S- c
cross_marquee.innerHTML=marqueecontent* q& c' }; e9 j
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth4 D; w; R" e3 S+ {
}) m+ j- J; j, u/ R' A
else if (document.layers){. @8 N" T3 T& b( }& [7 x3 T
ns_marquee=document.ns_marquee.document.ns_marquee2
8 v9 R# t# L+ |# Hns_marquee.left=marqueewidth+8
3 a) W! h. n# Q9 Z: ?+ nns_marquee.document.write(marqueecontent)5 D! M# Q3 o$ d& U+ n
ns_marquee.document.close()
. }! r7 f6 [% e2 iactualwidth=ns_marquee.document.width( T& \( o. X( `$ d
}
0 K% |6 H6 X0 j& |* c2 a4 s5 \6 Rlefttime=setInterval("scrollmarquee()",20)3 l2 m6 E5 l' s2 |1 E7 l
}. O! |0 |! b& X7 t9 ]
window.onload=populate a& p/ }5 i% F1 e$ c# D
2 }1 B+ ~, x3 ~5 O" Lfunction scrollmarquee(){3 j" s4 G1 M9 y
if (iedom){. V2 Q2 d9 }+ I+ A' t
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)): o) ]% q7 K" w1 n
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+ R* G( S Z. I0 F- r6 e- H
else
% M! C; V; P; ~5 v6 T. R5 ?) ucross_marquee.style.left=marqueewidth+8
- F3 o' ] M o5 T
( Y1 V: u7 @' D}
6 W6 i; M' F7 X* jelse if (document.layers){) s$ H) c: r. H; J. ]; o/ {
if (ns_marquee.left>(actualwidth*(-1)+8))
- J8 B+ p/ Z/ _! ]$ Y4 J% s6 Ans_marquee.left-=copyspeed
4 O5 p3 d9 \$ o0 w( v$ b# ~else
1 _. ^) E, S0 k8 {* v/ r/ j' qns_marquee.left=marqueewidth+8
n; q, S& L" M2 X2 E1 `+ D, i% n}3 W+ d6 u. v7 |. G9 M- V& Z4 U
}# ? M) i6 s. |& y6 w% v
, s. K, F4 g' ^9 t& d5 C, nif (iedom||document.layers){
0 {2 {8 ]* n) y7 f. @" ~with (document){/ n1 p6 G! I. F" e' A# F
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
5 C4 F/ \1 i$ }) P, D( Uif (iedom){! w( Z4 O; R+ I! Y B
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
9 x1 B( }$ ^' mwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')% q3 I5 C8 S* }9 V
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
4 E. n @* A, i* \% e2 }( kwrite('</div>')
( A P0 x6 k7 g" Y+ P' {( |}0 z4 H" }8 H: Z2 m2 o' A$ Y3 M
else if (document.layers){: N' @# ]; X* k* I) `; o/ k
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')% o/ E5 \4 q3 ~7 F* N3 P' |
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
1 Q$ Y$ X! W. a: M" ], P! n) ^3 P+ Owrite('</ilayer>')4 \( e% a' F% t. S/ P+ z0 [
}9 R2 z3 J. P7 r9 g. s
document.write('</td></table>')9 H- I8 z8 u! A; o
}
8 V+ ^, l8 N! o+ c, D}
+ i4 V8 u8 m0 t1 F: ~, q1 S# \</script> |
|