返回列表 发帖

网页之跑马灯文字特效

//修改宽度! x" n2 D) W  s2 D# V2 A* y8 d# m
var marqueewidth=300
% A1 b4 X& i& z/ G2 K4 c" w# z//高度0 K% b4 _, b- p  {* t6 u
var marqueeheight=25% O/ f6 J. g6 s8 d
//速度(1-10): K! e7 i) \( |7 Q
var marqueespeed=3& E8 m6 p6 c+ V2 w
//背景颜色
& j; K6 g/ G, q/ kvar marqueebgcolor="#FFFFFF"+ N7 }- C  C, V4 i# S
//是否能暂停 (0=no. 1=yes)?
$ e) e9 S3 X8 Uvar pauseit=15 b- O- p: X/ y9 m
, i8 S+ H- Q7 V: j; g8 p* k
//修改显示内容
- j' b+ X9 i: b0 y# {var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
6 z0 v9 t! v% u2 y4 W! Z- f! E" \, m  B6 w" F5 E7 D
# q0 b2 e1 @; R) J6 {1 N
////下面不需改变////////////5 z* K) i5 `: w
- h4 D3 P# U7 L2 m
var copyspeed=marqueespeed  f( L& |8 ?1 s6 L6 r
var pausespeed=(pauseit==0)? copyspeed: 0
+ [& u( q' J4 ?1 A% `( w/ I6 qvar iedom=document.all||document.getElementById
1 m( S# S6 C9 Pif (iedom)
% `1 X: T: @' V, Z( X. c0 adocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
$ S0 u7 U8 |- [$ e( u8 rvar actualwidth=''
; w& F$ o3 d3 _* r# z. b& Wvar cross_marquee, ns_marquee
" d/ h3 b# e9 b6 b( U3 z# I4 ?8 h5 C: G% D1 k
function populate(){- H; ^, Q! _& w' `; I
if (iedom){
5 V1 Q# L9 _9 k5 Zcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
0 j2 K' F: [- \; x9 |cross_marquee.style.left=marqueewidth+80 U: y0 O' `- A
cross_marquee.innerHTML=marqueecontent& D7 w. I# u3 q  X
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
, N* i: f) M" t. k$ I' E}
9 e! ]; O0 K. O7 y5 t) O* B# R0 telse if (document.layers){1 \3 o' n2 {# j& G
ns_marquee=document.ns_marquee.document.ns_marquee2
* t: a. w& ~, i% v" @ns_marquee.left=marqueewidth+81 k- P9 G0 s* b4 f( g7 E
ns_marquee.document.write(marqueecontent)
6 Q8 r% `6 C; |ns_marquee.document.close()
( r9 W' O9 e9 O; Lactualwidth=ns_marquee.document.width, T2 b# P* j; @+ W+ j$ T
}
, u1 t% o) T5 Hlefttime=setInterval("scrollmarquee()",20)
* h( N% w! h$ E}
2 M  g1 x" N  {0 c+ ^- U2 A( ~7 P3 [( b+ qwindow.onload=populate' q* B: j4 v9 _, `
( a% w4 C# g, B4 [+ k1 p2 b
function scrollmarquee(){
6 d0 U: i" |  e, b" Eif (iedom){& K4 B- n0 j% w; K2 e
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
6 T# J: M& ]8 l# x8 qcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed8 k+ |' D8 i; c5 H" L
else% }" q  R/ H( D7 `9 L
cross_marquee.style.left=marqueewidth+81 |. @! D" j* J& `5 N$ A
, E" G  h. U2 N+ W8 [3 K' l' c
}
3 |4 V5 `3 P3 Y" Melse if (document.layers){
' c/ m7 O7 J3 {0 u2 ?& H$ yif (ns_marquee.left>(actualwidth*(-1)+8))' f% P7 t/ S' [" O
ns_marquee.left-=copyspeed3 r  r6 p2 m5 Z- U) E% a& j# y
else5 K; X# j" O$ Z$ `' j/ d) b
ns_marquee.left=marqueewidth+8
/ A+ j2 C% f4 I- W6 w$ Y' o}
- \) z! S" L2 S2 [0 K0 _. _- U}
, u7 F' N5 \( B/ b7 m, f. }, j! L. n5 f" G
if (iedom||document.layers){
" q$ j" W1 l! F1 x5 r9 \with (document){
5 r+ t8 w, `0 u0 y5 tdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
0 c: W: v( x0 X" _if (iedom){/ F7 [- F( z; N- q- h: I
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
. |+ F  X( n/ v  F& W0 }+ f+ e; t! cwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
' Q/ \6 r4 g& o5 Owrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
& ?2 z6 \7 d" ~+ \9 \3 n# B* Mwrite('</div>')
8 K1 T" h8 Q7 D3 A/ S" Z8 V/ p}
. o' X6 |! _$ d! s$ w  c) _2 @0 Helse if (document.layers){
9 ~, `6 v1 q' s3 qwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
% |( W+ J, |, F. wwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')# D7 G. O8 ]* Z$ `9 L9 k
write('</ilayer>')0 v2 e" a, w8 A  m4 o
}
- o9 ]( i4 H: e$ m# Sdocument.write('</td></table>')
" M8 V' U2 |" S$ d: \: }6 w2 m0 V* l}+ R# K& Y5 m7 O  p
}( b/ B4 |( g# [9 Q* N7 n
</script>

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