返回列表 发帖

网页之跑马灯文字特效

//修改宽度! d; o8 R! s) P
var marqueewidth=300
" L0 f: i9 d  j4 M) q//高度, e. L$ }" G& D) A/ U
var marqueeheight=251 l3 J" N/ N  e3 {4 A
//速度(1-10)
  B0 ]; n: Q! l' p4 y2 Y; F7 `var marqueespeed=31 Z" J1 p. j$ ]6 b& [4 n- Q3 d
//背景颜色
1 P8 I4 O" e2 X. \# R9 Avar marqueebgcolor="#FFFFFF": _! |# O8 S% b2 E0 M2 N/ T
//是否能暂停 (0=no. 1=yes)?
' R7 F1 O& j/ I, a+ P2 [var pauseit=1
0 R4 N) Y+ \/ q$ \
) J- n$ k- n, u. o( O//修改显示内容
9 E+ R; C- `# {var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
' j: j  n3 f5 G
( w: J+ ~  b+ Q5 ?% I( Z) N/ s* @* T! S& ^* K
////下面不需改变////////////
* e% {. Q: G$ Q( V5 ~2 A
$ Z/ d" Y6 e# t6 k0 O5 Svar copyspeed=marqueespeed
: o$ y0 n6 q7 H; _- t  s' Hvar pausespeed=(pauseit==0)? copyspeed: 0
1 R7 ~8 X& `' Y; ]var iedom=document.all||document.getElementById
! J4 f; K6 O0 p! v1 Nif (iedom)6 p+ b' s, L6 ]* k0 t+ Q2 t
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')* @  d. {3 a/ h7 M, ]
var actualwidth=''
3 m& i4 E7 E8 p7 Q8 `+ _: Gvar cross_marquee, ns_marquee- S9 _/ J& L2 z. |& d" F" g
+ Q5 ^6 [, J4 ?: ]/ v# q) M9 m
function populate(){
7 t- C6 c8 ]2 Q3 bif (iedom){* f. A* Y- W) s7 M( y" V' ~: E% E
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee; p& w  n& d7 q/ s( H& A
cross_marquee.style.left=marqueewidth+8, Z* X, l) k4 M% B! M
cross_marquee.innerHTML=marqueecontent
; O5 T3 U% Z# b% ]' k8 t  `, ?actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
: s0 Y! L/ ~# x1 d" Q) m. m8 K}: F3 I) }7 R# }& V: m
else if (document.layers){1 n4 y7 P9 w+ y4 @, ?9 R" |
ns_marquee=document.ns_marquee.document.ns_marquee2
' a# |7 [0 Z0 ?$ n, F" Zns_marquee.left=marqueewidth+8
, Z; d( _4 J4 C2 Q' Zns_marquee.document.write(marqueecontent)
+ U2 Y0 Q& I9 }" l1 ^, r' e! Ans_marquee.document.close()" w5 [; R. i' f+ I  A: ?1 U% Z
actualwidth=ns_marquee.document.width5 _: b# E- S! l% A+ [
}
- N9 G! i* b4 z. T3 l1 ?$ S, h& Jlefttime=setInterval("scrollmarquee()",20)
" w/ x" O# J) ?& s. d+ L}. H; z; m0 i" j# f& h5 @
window.onload=populate; |+ ?  u& Y1 o
2 a; ~, v* m8 a/ e% @" {) i
function scrollmarquee(){0 X7 j/ I" l: W+ M; S4 Q
if (iedom){
/ S" v1 e! a' g. g! M: lif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)); F8 M2 E0 L7 T1 k! v4 u9 T
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed, F  b; V3 x) p2 Y" ?. ?% {
else
. I6 t- w$ P) F- }% q2 H9 `cross_marquee.style.left=marqueewidth+8
6 G2 h6 }3 V7 h+ w% \: g
4 H) X' c. n2 G}
0 n! C! R9 J& w2 \9 G, n+ u; Aelse if (document.layers){, b/ d9 Y" I2 O2 @! {/ Z9 l
if (ns_marquee.left>(actualwidth*(-1)+8))
4 s8 [( ~! Q( E  u/ ans_marquee.left-=copyspeed: Z0 N# Z: L! w/ J3 G# l
else' P$ v/ ^* `6 T5 I4 ^! `; B: ]
ns_marquee.left=marqueewidth+87 O8 A+ a: t! M- E/ w* H
}2 M- R! X0 M: J4 J% g. ~
}$ z; R/ z" [7 ]: }, Z& x
1 d1 u# `2 Q6 z0 i4 w
if (iedom||document.layers){9 K$ n+ N- Y5 M& \& T
with (document){9 s1 h$ X2 u: v1 M# n9 I
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
& R7 l+ @' }$ i2 L  x& Tif (iedom){6 @& N. z* Z5 [! W3 Z: r# U
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')1 @& h2 b! ]3 g+ t7 x
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
7 p2 B0 |- K/ d1 }7 j1 L! hwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
$ W( \7 j5 D% S4 ?$ G; j: bwrite('</div>')
/ X# ^0 L* a- O* B( [# R( N}
/ V$ V5 J) y9 h4 Belse if (document.layers){4 [3 n* u* Z% P: F- C9 _
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')' `0 g+ n7 Y8 d/ T, k1 H0 q( m+ v
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')5 A; c& M6 ~; u* D4 k
write('</ilayer>')
  P) j: `8 K* I* e7 S6 {$ x}7 D# n% I5 g5 U6 q1 M' a2 O
document.write('</td></table>')
8 \; D" A) Z9 z}
3 v1 l% l3 }% V; q4 l}+ M3 V0 g% J" W  r$ O6 }) c. T4 S
</script>

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