返回列表 发帖

网页之跑马灯文字特效

//修改宽度
" m7 z( x0 s0 V4 e, B3 u8 Nvar marqueewidth=300
& W1 }, R4 e4 [# x" y0 d//高度
1 f& J2 ?8 M- o' ivar marqueeheight=25
0 F, L! t: {( y  K8 m( X  Y8 a//速度(1-10)
# @& a: \9 V) M& ]4 gvar marqueespeed=3
" _' ?, _. O, i0 Q+ P//背景颜色
2 F4 l( T0 c8 d- \1 svar marqueebgcolor="#FFFFFF"
# T2 {2 w2 T" b/ D6 j" }* o) n$ R- v//是否能暂停 (0=no. 1=yes)?
9 N$ E% j) g% cvar pauseit=1
& l6 d# O+ c5 h5 k) j4 R) A8 f" M. {$ \
//修改显示内容  z& U& h+ C( e9 U0 k, h' d
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
/ O& A, \+ `' R% S
" v! s7 y0 `  Q, s2 V4 ?, I: S" F9 }2 Y2 H) V9 }7 T. u/ g
////下面不需改变////////////
1 q, H# C# ?- V* Y5 M" i$ @9 s: d+ f1 z, K, C, U3 @7 m' v
var copyspeed=marqueespeed
6 g; j* h. A# N2 Z! y2 nvar pausespeed=(pauseit==0)? copyspeed: 0
9 c5 E8 R% B1 e4 Vvar iedom=document.all||document.getElementById
' y% h4 }. V1 X5 ^" J7 y9 sif (iedom)
$ X7 r- `% e/ b' odocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
9 N. K" w/ B" g6 s+ h# Bvar actualwidth=''5 \# ]( M% V: z8 P2 b; \! I
var cross_marquee, ns_marquee
4 Q" M5 M- _/ j/ T' r3 U- ?& r0 N" |  R; }$ A+ v1 v
function populate(){/ \6 M+ y8 j% V6 R
if (iedom){
, ~. W+ ~( y2 g% hcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
2 r7 T$ n9 @; a& W$ @( A3 Ncross_marquee.style.left=marqueewidth+8
: i+ i" f) H# ^7 X: u5 i/ T7 Dcross_marquee.innerHTML=marqueecontent, o3 N& i% u5 P' ?8 e+ J* Q
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth0 ~; H2 o/ d, D+ W8 l
}
6 ^+ G4 I& W7 U* A' N  Gelse if (document.layers){7 J5 t. E% A! M+ b6 r, O' E" s1 @
ns_marquee=document.ns_marquee.document.ns_marquee2% A4 d5 Y; I% o" O! p, O; I
ns_marquee.left=marqueewidth+86 M9 s/ p4 B4 Y( [! e' `
ns_marquee.document.write(marqueecontent)) J7 V( l3 `; X+ e( d. B( w% c- H
ns_marquee.document.close()7 K6 X% O& D" h% h' f
actualwidth=ns_marquee.document.width
) {# A( F( y6 }) a$ d7 t}* s+ F! J- g3 A2 K" r  X
lefttime=setInterval("scrollmarquee()",20)
: \; k# ?+ a) ]$ R}* i4 E& J& T7 |, a# c
window.onload=populate
: K' P9 [7 F, G5 t- b
/ W& q( q4 n4 M' \function scrollmarquee(){' n  S$ G( \! @9 J5 o' q
if (iedom){
3 C* {: m  ]7 P8 Q$ Qif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))+ o% P1 _5 [- G/ ~3 a) \
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed3 N# B7 k+ P, V" O  `# _
else
3 Y. F( G6 S5 D+ i# o3 k8 A" }9 |3 jcross_marquee.style.left=marqueewidth+8
1 ^; R) B1 g2 H6 K& B! V- ]- K1 b. A( _& i- a  d; o
}+ u; ~8 Z0 c3 V/ Z  h" N( P
else if (document.layers){; q$ b8 t0 O8 Y, s
if (ns_marquee.left>(actualwidth*(-1)+8))  K7 }8 f; |4 C2 `
ns_marquee.left-=copyspeed
2 w; _4 f7 A3 s: L9 eelse
7 w4 F' T$ R9 u6 }ns_marquee.left=marqueewidth+88 p+ |- p6 u7 S7 q7 n( g
}$ c4 S  u. K8 F( e) v) e
}
/ l, U  u9 t; b1 g  a  U  E  @' j6 `/ ?
& L. N5 B$ Z. Q; D  O, bif (iedom||document.layers){
* T+ M# @2 \7 r3 K, U* |5 v; h0 u% Gwith (document){3 ?$ g' D) p7 Q! h$ l7 B- l' R
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'). f5 W9 s* t5 [  T" m; b0 ]
if (iedom){7 X# H7 n/ d/ R! |) I
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')/ [  q) S5 p( a+ Y: i1 }, ?6 X+ n: G
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
& P3 a3 U8 S1 i7 ]5 r( z" Z9 Zwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')! v0 w$ R$ M# X$ v
write('</div>')0 o+ R4 @* T. J. O
}) i" f1 E8 m, i8 p7 b% d* N
else if (document.layers){
( u/ E4 i7 d& C! B: Twrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
9 Q9 O" n  q* Z, K, \' c9 x$ kwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')  F: ]) x6 H3 ?' ?) z. ]5 v
write('</ilayer>')
: o$ n' F- p: |}
- \% ]  P' H" D8 x. |, idocument.write('</td></table>')
& w+ H5 q) N: P" _6 I) M, \% _}9 f; K( m7 X, F' |. W; u9 S( s
}
5 v9 `7 E4 J. e7 [8 ~7 A6 i</script>

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