返回列表 发帖

网页之跑马灯文字特效

//修改宽度0 U% U: X* _0 y& t) L' _  w
var marqueewidth=300; k4 B3 q0 |$ @) |& p! E
//高度9 q' x7 G" ^2 w3 [8 O) V2 [: `
var marqueeheight=25# Y$ v, j; d: e) @
//速度(1-10)- a5 Y  I! R. I& C* [3 d
var marqueespeed=3) X( Y0 r8 v( W. r4 F+ |
//背景颜色
1 g1 k# z" |; H! G5 ]" M; rvar marqueebgcolor="#FFFFFF"1 m1 h1 M+ y* i, O6 [4 B  O$ S6 ~
//是否能暂停 (0=no. 1=yes)?
& w5 a8 t# _/ e( H$ K! j2 |+ [. dvar pauseit=1" q9 R- U6 @3 N1 {! z; [
+ d5 E; }, U7 J3 n6 E1 V
//修改显示内容
/ W3 _4 J; }) o- K& Rvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>': o8 ?$ W" q+ x3 {8 j

2 d, x* c0 |& Z6 D2 d$ E7 a* b. `4 t7 v( n
////下面不需改变////////////
' A, @2 q7 }( E4 F
/ ~. E4 G! W. b, v' Q# j! h. avar copyspeed=marqueespeed
* m4 q3 @0 c8 j+ i- s7 d  |var pausespeed=(pauseit==0)? copyspeed: 0( F$ S; @! V" B9 A# t; b
var iedom=document.all||document.getElementById- s2 _7 o# {3 n) D6 S7 A0 _/ ^
if (iedom)
$ o6 x* L& E- D& g# @+ q; qdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')  I: H. Z3 f4 n, P  N9 ]6 ?8 m- |0 n
var actualwidth=''. J: W; V- t+ j$ m! L1 n( W, w
var cross_marquee, ns_marquee
7 _$ R& J! ~* v# s, |) W0 `2 p% A; F# @* h/ M' }7 A( F
function populate(){
2 V# J( u9 n, B# W1 u- I" H' Fif (iedom){
* l- W; [! i" w( {) c: [cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee% a$ ]+ i( j" l$ R9 ^
cross_marquee.style.left=marqueewidth+8
2 f! X- n" N- L3 J7 Y' kcross_marquee.innerHTML=marqueecontent( H) j* k" k- w* l
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
4 X8 a/ d# {2 s* {}1 o: R/ G% V: r9 G
else if (document.layers){
1 Z# F) D5 F. r, m) O6 uns_marquee=document.ns_marquee.document.ns_marquee2. m- P6 ]# R4 _+ n( g
ns_marquee.left=marqueewidth+8' h1 i; y7 \3 r4 ~4 Y$ |  k
ns_marquee.document.write(marqueecontent)) z6 r) W% Q: Z% O6 x
ns_marquee.document.close()
* k  }$ }( r+ K$ Z$ N0 J3 _actualwidth=ns_marquee.document.width6 l) `% ^* R6 B, k7 S
}
1 c/ M; o/ y" f9 _& _: M/ Nlefttime=setInterval("scrollmarquee()",20)) Z% ]5 q3 f4 n8 ?4 l9 p' |$ X' ?
}
5 T! `' b1 I; s( B) @* Wwindow.onload=populate6 M9 A+ C; o+ B$ f% ]! r+ ?, b- Z
, @9 ~2 \  C) A1 f7 \4 z9 n* T+ c
function scrollmarquee(){8 W  g& f  `' d. h3 _0 d
if (iedom){
7 k4 {# w# w( C$ ^6 z2 p. F  W  Kif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
1 ^0 J$ F  O9 b; `8 t. Tcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
9 U. [9 u9 Y7 E+ I' N$ S3 Pelse
) c9 I0 K( q9 Vcross_marquee.style.left=marqueewidth+85 s5 m% p* H4 p. \6 o3 P! y8 [
3 k4 h( r( W3 c% b6 B
}
7 m2 m6 ?% W9 f! u: I5 N* q# telse if (document.layers){
7 _7 l2 T6 p$ k2 a2 zif (ns_marquee.left>(actualwidth*(-1)+8))3 k. Q; Y9 R% O3 ?  P8 V
ns_marquee.left-=copyspeed# C4 m; F' p  U% b8 G0 x- b
else/ m8 J0 \7 u3 D" ^- {, @) Y4 f
ns_marquee.left=marqueewidth+8
6 [; g5 S' ]+ Y0 r}1 k4 r9 {% `8 t4 c3 I5 s
}1 D5 ]: q/ I  g4 I" v8 r5 i
8 G- D1 y" X6 {" |2 @6 A
if (iedom||document.layers){
+ w+ s9 P/ N* G' o2 }) X/ ^6 w" Z6 ywith (document){
8 F; A, C, i7 g' d) i+ Edocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')) U: V) D2 h& q+ E2 O; E# b/ r
if (iedom){, [. R' j6 W9 P" j
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')$ @' J/ ~4 T, t( G
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
& i: X: A1 _  hwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')( h) T: o1 _  J
write('</div>'), N9 O) S: T: B! E
}! M3 ~/ ~  ~  v4 m5 e: s3 p
else if (document.layers){, H6 ~: \. S; Z& k, p
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
6 R* U; Z. G7 g2 [0 H3 q9 |write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')% [% o- D/ h$ Q& z0 {
write('</ilayer>')" j8 ~# m3 f& Z$ z; z
}
; G# b! {9 `* i+ T9 Y5 F+ Ldocument.write('</td></table>')
: S6 P# x4 e  k' t  L/ @}& ~  x9 n! L3 T
}/ j* a' D+ Y/ d9 S- ]
</script>

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