返回列表 发帖

网页之跑马灯文字特效

//修改宽度4 L1 a) ~$ D2 R& W* J) }$ N/ I6 x
var marqueewidth=3002 A* l& G6 \/ ^, N  Z1 r  y  S
//高度# _6 d7 K/ U( f! `+ T/ Z
var marqueeheight=25$ i. ]) {% M8 F
//速度(1-10)
! {$ y( g1 c: l3 l& hvar marqueespeed=3
- @/ i% v/ f# S+ O//背景颜色( A$ E4 |+ `0 p* p
var marqueebgcolor="#FFFFFF"/ p7 P; C6 |6 q: J4 Z; q
//是否能暂停 (0=no. 1=yes)?7 `0 R" U  O* \. s( H
var pauseit=1
2 Q9 {. k# i& H9 A; X
5 m1 @2 F0 q3 T' _//修改显示内容
9 U7 x& b0 w) [$ x! y: lvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'8 u( e' _# }. e" L  {, o

) F2 J; k  h2 m* K  R# N& F7 |9 A/ F" L* {, A& z/ p
////下面不需改变////////////
' b8 y: A9 }. k
1 {# }9 U9 y  B7 N% y  g5 Wvar copyspeed=marqueespeed) {4 D5 @! I  R" G
var pausespeed=(pauseit==0)? copyspeed: 0
$ U3 d4 g/ }  t1 H+ ?var iedom=document.all||document.getElementById
6 l# y5 H/ A# h/ g7 Gif (iedom)
4 p* C; F# y2 j; a9 Gdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
' T! ?: [- L& L5 E' a# L9 zvar actualwidth=''
2 F5 J) {; l/ F5 n* i4 M$ Yvar cross_marquee, ns_marquee' T- @3 u6 N& u; Q: h; Y9 R
2 |7 p7 A6 _$ Q# F2 p
function populate(){4 I3 r, ?2 Z9 Z5 o# h6 o2 U$ B
if (iedom){0 N6 L! W" k. l6 v  u( V" l! u
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee; i( \6 z6 a, W( d# ^+ [2 p
cross_marquee.style.left=marqueewidth+8/ Y: U1 n; p1 O, P8 i2 v! k- J0 H4 J
cross_marquee.innerHTML=marqueecontent% ^( b) ~) c: y
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth: w7 y2 R1 P- Z5 ]* g
}
6 m8 }- U+ Z+ O% }else if (document.layers){( q6 s" P  S/ V6 ]; D! |# u' b
ns_marquee=document.ns_marquee.document.ns_marquee2
+ O4 y( q4 }; S2 Y8 c  Ens_marquee.left=marqueewidth+8: x; w# V7 s$ o( u, O- `$ L
ns_marquee.document.write(marqueecontent)
2 _7 U1 u$ i4 T; v' e, Vns_marquee.document.close()) `& X6 ?8 M; E: k( a  u
actualwidth=ns_marquee.document.width
/ K. \  w$ ~" ^1 S8 `. a}" {* ]: M5 o1 h
lefttime=setInterval("scrollmarquee()",20)
# q9 c, }) ~3 c5 ^}% e* m3 u/ F0 }$ Z6 C: c
window.onload=populate
. @! y3 u& W" h3 f  Q- K3 C+ d* |7 M- f% l1 y3 e
function scrollmarquee(){
* ~1 z: G& _# g% a( E/ U9 lif (iedom){
2 o  \8 s: k3 n( r6 y- _if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
( ?& g" W$ D4 H8 D! Hcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
  T  _; A2 \1 h  ~: W7 \! @  }: kelse
2 p/ b  U; c8 @- Y! Tcross_marquee.style.left=marqueewidth+88 L4 Y# N/ y- u! H
8 Y2 g! Z5 E# |7 N7 |% N8 B0 V
}  N5 D, C5 t7 j# Z/ N( M
else if (document.layers){
; a+ p2 i5 `5 w: C. nif (ns_marquee.left>(actualwidth*(-1)+8))
  i- w& R3 B  L& _) K! Gns_marquee.left-=copyspeed
6 Q% p9 h  `8 ]3 \- W0 U6 nelse
: r7 q: L( r0 c, ]% Qns_marquee.left=marqueewidth+8. v3 Q# w, x4 x, @0 B% @' p6 s) o
}; O; |! V9 Y: [1 Q
}
2 g/ Z- S  Q% ~# J; J0 V' l1 s: _4 i( _
if (iedom||document.layers){4 J+ y  S) _- y. E
with (document){
1 {: e, f# Y  Z3 t: fdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')+ R" O% y$ V* S$ ~3 w
if (iedom){
* s6 p, _% e" Q  qwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
4 |1 _$ [* d- W6 d2 K  X! s( v- Iwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
( f, u5 d$ u5 e; D& T+ ^, L, l4 ]write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')% k; X7 k) Z. u5 x; S
write('</div>'): ~2 K8 i3 L, i6 I- D7 Y7 X
}
4 y5 e2 w6 `3 G) ^) p. ^else if (document.layers){- s0 r$ P! J; ^% \% d4 p1 l7 `9 R) q
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
2 N8 @+ b4 `+ }  `) q( i5 Twrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')5 U+ \: a$ d% P4 q* L  E
write('</ilayer>')
# @  A! p. D6 A4 U8 N1 ]}0 ~2 v7 U$ H, f( M( G
document.write('</td></table>')
/ d0 n$ {2 M! R+ a}% f4 l, i- x! j! b
}: O, C- L8 Q9 g8 r
</script>

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