返回列表 发帖

网页之跑马灯文字特效

//修改宽度- h$ }* Q( i( z3 l# W) B6 A3 `
var marqueewidth=300/ A: N1 I7 h; m$ _- \& N
//高度- I* o" r$ k9 M' ?
var marqueeheight=25
$ e( y! i6 M4 ~8 p4 K$ p& i//速度(1-10)! [" D! [" t4 J& q
var marqueespeed=3
* C/ u$ A" |: L* ?$ X//背景颜色
2 X5 ~& p' W, ?: O- v( vvar marqueebgcolor="#FFFFFF"1 f( K) E. Y8 o
//是否能暂停 (0=no. 1=yes)?
) H: S/ Z2 i/ T% J- Dvar pauseit=10 V! `  n# W  b! p) b' M3 W# I
/ D$ W, T  @) T
//修改显示内容$ h0 B( v( k7 _& U4 Z! x* m# C( ]
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
6 f3 d) X) {5 ?5 F& d* V9 A
$ O; }$ r- @/ J. U" [+ ?
/ `1 f& t, ~. y# v5 T////下面不需改变////////////" ]/ Q) s9 o3 y) x2 E6 G

: f9 t/ n7 E( [, Rvar copyspeed=marqueespeed
, I/ B7 E+ K1 g" J/ l; ^var pausespeed=(pauseit==0)? copyspeed: 0) L8 K0 u% \# T
var iedom=document.all||document.getElementById/ Q2 C  x  X. S- P6 B" s
if (iedom)
) O5 J# o4 o" E' K0 C: bdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
2 s2 d2 y3 U# ~) G/ G% K& e/ Bvar actualwidth=''4 H' ]: Q9 Q+ M
var cross_marquee, ns_marquee
4 v( K) r' d. J: z9 D8 h! ^; u1 ^
( a, b8 Q7 K& O6 V% X; A1 Y  bfunction populate(){
# J4 p8 A8 M- |$ a$ Y( Aif (iedom){
* H2 M  \8 M$ R6 `3 hcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
" r# ^. G3 j" across_marquee.style.left=marqueewidth+8) p6 F+ |7 G! a$ U9 `" ~. v
cross_marquee.innerHTML=marqueecontent, y, n' O, B1 @" Y. F7 V: k& v$ _
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
* p% m) Y* Z* R. V}) m- u' Q- M* K0 [2 w) U
else if (document.layers){" {1 Z7 H4 q4 w/ S& X, S# x
ns_marquee=document.ns_marquee.document.ns_marquee2
7 O6 M$ w! I$ e- V, k- mns_marquee.left=marqueewidth+8
& `' Q0 U+ Z, m0 Y  H7 a& n4 Ins_marquee.document.write(marqueecontent)" f$ q* W, K* L
ns_marquee.document.close()& w8 m* b* z+ i; S( c; X3 ^4 v9 B
actualwidth=ns_marquee.document.width" a( h9 ~/ x6 p. c6 |
}
8 s$ E- X& ~( z9 a" clefttime=setInterval("scrollmarquee()",20)
) N8 D1 O7 z( s}" [) \# f: [1 r
window.onload=populate
# f6 e) o1 x9 X9 t3 C2 N$ b2 v2 T: @& ~: P+ n
function scrollmarquee(){
* f$ L0 }, \/ P' Y8 b6 mif (iedom){
' ^. O6 N5 W- W( Qif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))0 @0 w) C8 A, s9 [
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
9 G8 d. Z5 f: V9 K8 m9 C& U* Welse% `1 K5 v6 z- r# A7 f1 ^# v) D( f
cross_marquee.style.left=marqueewidth+8) M/ u7 M" `; f( V& P
  g4 d1 R6 }$ q! Z9 `6 l
}" \( Y: }4 ]) a1 E
else if (document.layers){( {+ d1 g+ L$ P2 V- e5 G) S
if (ns_marquee.left>(actualwidth*(-1)+8))' d  r7 S# G) N4 F- E- o
ns_marquee.left-=copyspeed
" t& F8 v8 n! l& b; }3 t- g7 n7 uelse) `3 Y1 f) e2 u; n- M
ns_marquee.left=marqueewidth+8
' J# C7 Q0 c- z8 g; ]}6 H  _6 s0 m' m8 f' L7 b
}
. ^/ p; E' k9 l8 [' F) M3 S. U3 f! r1 k7 l9 e1 ]$ ?8 `
if (iedom||document.layers){  g7 j3 `4 z$ {# j) M# O
with (document){
# K% O- x# }* Z# l. }  l% Rdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 n! K7 K3 r0 ^7 v4 {
if (iedom){+ J# C: m- r# x2 x+ T! ]
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'): A- ?( O! h; I
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
1 A% ^3 m' j# d6 T. {9 p4 K! q0 p' @write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')* X; X# ~, L; K. g$ t: `, b/ w
write('</div>')% m" n( X% V  e  u
}( |! p$ r! s1 ~& R# y
else if (document.layers){1 h7 }: [  U, k
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')' C* V+ t+ _$ J; r7 E& C- K
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')# V( ?+ I2 R/ E- n. S" |$ A$ v
write('</ilayer>'), r5 E. ?7 |" k/ ?: L
}" F0 T0 f5 K8 y, V% E5 B
document.write('</td></table>')
3 O: n/ k) g, T, P}
. T  M0 l8 b. M8 T6 A: V}3 G) A/ K$ o" k3 @
</script>

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