返回列表 发帖

网页之跑马灯文字特效

//修改宽度  C* U" L- ?; y$ R, K0 E% O! O
var marqueewidth=300+ q% J( i) j9 n4 M
//高度
  v0 N  `2 K3 O. W* J# v% bvar marqueeheight=25
/ U5 @. `8 N6 {//速度(1-10)2 ?2 o) M% r, p- H6 O- @
var marqueespeed=32 H2 Q3 [* G! Z
//背景颜色
+ z6 }3 ~" l: z" A9 b0 w' Kvar marqueebgcolor="#FFFFFF"; U0 a( J1 P* F( t2 i' Y0 V
//是否能暂停 (0=no. 1=yes)?
( H7 f# o. s6 L" Cvar pauseit=10 r! m% B& w, H! m  s

8 o5 N# I, U. ~1 U' p( \//修改显示内容
! p6 p$ f1 L2 y- f- @, j% \2 Gvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
: ^* D/ C2 c2 ]- t
! E1 r4 v% n% e8 U+ w* L% i/ w. x5 ]/ ~6 k
////下面不需改变////////////6 N" W) `! N# _: Q- T

3 C  p. z. u7 @var copyspeed=marqueespeed2 e: O( c% `. ?, S( \/ |; h$ A" ~
var pausespeed=(pauseit==0)? copyspeed: 0( G2 {. j) a9 e5 h7 h5 P3 N) ~
var iedom=document.all||document.getElementById
, l& a  v6 @  J/ W! G" pif (iedom)
+ U4 f, {* N5 p, adocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')1 V1 Q8 c& l7 ^# X
var actualwidth=''
( W; B/ ]; b7 m7 h1 W; bvar cross_marquee, ns_marquee$ g# G  m# q" {# `# l

. h$ G8 g6 ?! O# J9 q' Efunction populate(){
& e; ^& k- m, R: E, _, F1 aif (iedom){, L9 H3 i) _9 d0 P! @: g
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
! X, @2 i+ C0 b  e7 ^  [" Jcross_marquee.style.left=marqueewidth+8  _3 q* U8 z# l
cross_marquee.innerHTML=marqueecontent
  G$ p- e$ h8 a6 f& qactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth9 [* a  g6 [! z) B
}$ A& ~. y& W1 g: ]
else if (document.layers){
4 p) O* M& U- v9 F3 U0 J/ J% D6 Lns_marquee=document.ns_marquee.document.ns_marquee2
. Y7 f8 k- F* r& W: Ens_marquee.left=marqueewidth+8. g, C0 `# x+ |
ns_marquee.document.write(marqueecontent)
( o1 n7 v, f3 ^- w  Dns_marquee.document.close()
' K! E2 N! N6 H; U; o% w& K  ^actualwidth=ns_marquee.document.width  M8 B8 {, V; Q4 ~
}! z% V/ _" F% ?5 |2 f( ~
lefttime=setInterval("scrollmarquee()",20)  C6 P# H1 X2 v& |
}4 `! u3 r& s2 h5 }" U
window.onload=populate6 v$ t/ I$ R/ C0 `7 Q- o4 H9 n

' n& v4 v, I& p" k9 `& a3 Qfunction scrollmarquee(){
0 c2 e1 l1 _& |! |if (iedom){
( ~3 d3 r# z, Uif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
5 ~# j4 }/ u% z6 X4 P* _cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed% K$ Q) e- W3 K0 Y, `6 B9 ?
else( b* A1 }+ ]$ y, S7 D$ x
cross_marquee.style.left=marqueewidth+8
# d/ n4 x. b3 |+ h# |. r, J, B- Y! M# u7 g2 \6 w
}$ h7 i: K, {$ k- t) s
else if (document.layers){3 K( Q4 Y8 m& N* T
if (ns_marquee.left>(actualwidth*(-1)+8))
, b! f, @' ~9 q/ @ns_marquee.left-=copyspeed1 S1 ^' g0 v9 |+ x& P$ ?
else  W- H9 w7 w" S
ns_marquee.left=marqueewidth+8# Y7 Q- D0 u& l1 h8 L
}# c6 t5 o! M* H5 e2 p7 i8 R
}: a8 i* b3 u- s$ [
4 Y5 U! m  f4 Q0 v: L6 w
if (iedom||document.layers){' J7 @/ l% F2 {8 R
with (document){' O" T: x& c- A8 `. ?. z- d* Q
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')9 ~( }' {  f* N( r& {
if (iedom){
: U+ Q5 C$ E5 l2 I2 y3 Vwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
- d( z2 ]1 x! e+ H/ q8 _write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
$ U1 W+ ~0 Z- p0 h+ t4 v6 S; ?write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
( R# Q3 T$ s6 N" F; Rwrite('</div>')5 c  s: c. i% r. d8 n! `! E: j
}
  L$ {6 `5 l% g" Q7 d' P# U6 \" Telse if (document.layers){
4 t8 a# s. X7 y- [& ?5 {write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')- k6 D) a8 Z  m8 L8 U7 U, f; M
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
+ j( E% s" `( i. b$ M7 Awrite('</ilayer>')* v6 G: y5 y6 |( r
}
3 N: H, e- W6 ?# idocument.write('</td></table>')
6 y! x3 i4 E; y/ B$ L; c) L}, ?! s2 a3 c. a' }$ P3 {) o5 F3 c
}; j8 O* H/ M3 R% m2 f
</script>

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