返回列表 发帖

网页之跑马灯文字特效

//修改宽度
% r+ b2 q: n: T. c: u: y$ P  u. ivar marqueewidth=300! z. w( C: A7 [2 @3 V0 X* x
//高度
9 `! @8 y: A1 e9 g# Ovar marqueeheight=25
* h0 o9 U+ ^. O//速度(1-10)- o8 Z  v/ f& @. w+ ^, o7 j+ y2 K
var marqueespeed=3
3 L! z( T  {# q# i/ U0 j0 f. i//背景颜色
4 G2 V" U+ W0 q: h' c9 Cvar marqueebgcolor="#FFFFFF"* I# q/ h  T4 L2 _5 g4 k) j
//是否能暂停 (0=no. 1=yes)?. S8 r( X/ S' V
var pauseit=1. g- V3 Q9 {& ~% n2 x( i6 n; x

( F; c/ C  {+ d9 N+ E//修改显示内容' `* T6 C7 r% A) {
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
0 @# \) _9 a& _8 k6 J$ q- v/ y5 c2 ]5 t2 n% X0 b
. ?3 Q" Z5 U  F/ v( r
////下面不需改变////////////
3 H1 D4 g8 h; g& n* I- e) ]
2 [% V& j7 R  f  f0 j' i. G' uvar copyspeed=marqueespeed+ b# o! }, n3 x4 f& d0 C) H
var pausespeed=(pauseit==0)? copyspeed: 0, Z7 C+ I8 g4 z, ]5 C% Y6 n' ~% B
var iedom=document.all||document.getElementById! D( _1 m; {, z! }/ Q$ r
if (iedom)
7 q, }/ J- v0 [+ [document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')! {% V" O& t& Q1 ?
var actualwidth=''
8 Y1 a" {+ Y3 q/ Xvar cross_marquee, ns_marquee0 K; `% F! T, m

6 p: N3 o/ W9 Ffunction populate(){, w7 Q& G7 ]( ~8 q- M  w0 I( X
if (iedom){; s2 b, z/ p# O6 j3 D4 Q2 V2 R7 O
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
8 D  C1 F3 `2 I. |& d( Ecross_marquee.style.left=marqueewidth+8& K- K. N- ]% s2 W6 q
cross_marquee.innerHTML=marqueecontent7 M3 i" h3 e/ q6 A4 w
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth/ j/ m  u$ F! C; l# i
}' [, _4 W6 X0 R
else if (document.layers){
/ w% l2 Z$ U6 D6 J% g: ]ns_marquee=document.ns_marquee.document.ns_marquee2
3 e- U% R2 w+ u( O- ~ns_marquee.left=marqueewidth+8) G, e: q* q; D4 {$ C' {: }
ns_marquee.document.write(marqueecontent)6 K/ T4 N( \3 j+ y% h
ns_marquee.document.close()
- e8 R% e9 ]3 Q' u+ a: W, J5 Jactualwidth=ns_marquee.document.width
, G3 y" R; }9 p) Z}4 ]- \. O8 W% j8 T
lefttime=setInterval("scrollmarquee()",20)
' C7 }- n4 N6 d- p3 I3 B; L}
" W& r: s" o3 l  p6 }window.onload=populate  B" g% W. G/ \  ^1 e, z; _: `
; I1 f/ H- \* P: s  Y2 G
function scrollmarquee(){
. [0 o, o+ ~7 N1 l* H( z* ^if (iedom){
3 [& G* f# J5 C' @. aif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))( U$ ?* O3 y$ x8 F
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
6 C: ~0 y. I* Y0 Felse( e, |1 b7 d8 O
cross_marquee.style.left=marqueewidth+8
6 S# b" _" b9 A  T) |5 F, J
& z2 H5 ~# B9 P4 X}. n. u7 P, T# \/ L
else if (document.layers){2 O3 E! }* Q3 t
if (ns_marquee.left>(actualwidth*(-1)+8))
) j5 C  y0 F/ C; w! vns_marquee.left-=copyspeed* c' _/ N( O! M) t
else4 \6 i8 }, n, F1 K. c4 _  g
ns_marquee.left=marqueewidth+8
$ D% j$ u( I" ^}% `  \3 M; ~  I9 o# g4 e
}
1 c3 T5 `2 q" ^5 C- y8 H0 G
* N  |7 c  O: n" _) z) cif (iedom||document.layers){5 o4 C) C  n2 K! n; e3 B
with (document){" G$ d: T' }' P# {; m
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'), \: k0 Z8 {, q6 R7 d6 v
if (iedom){- E  H# K4 d7 ~! z
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
% W: a- L+ Z- Uwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')4 E3 J4 @5 E  C5 `: f4 b
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
. m$ t% S* e, Awrite('</div>')+ Y& ]! v9 n( b8 c9 X
}2 }! t% z  l# G7 ^+ o. o
else if (document.layers){
1 Z  `" M) t3 z6 G0 P1 v0 \% J; Awrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'): ^$ Q% h' ]- M' V
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')6 B: J+ o# k! Q+ B' Z+ C
write('</ilayer>')3 @+ \( O) r' z- L) [5 f. M+ d
}
& J9 M  _) H. |/ b; `; Jdocument.write('</td></table>')' d1 v4 O* B7 O+ s+ w: n9 M$ h
}
( w5 m* P6 }* @  E: J' G: u, M}* M# i$ w1 S- ]: r5 Y
</script>

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