返回列表 发帖

网页之跑马灯文字特效

//修改宽度( \/ M5 G1 ?! Q6 P8 B
var marqueewidth=300
, F: e7 ^6 `* k//高度
4 D8 @, n/ A$ H# ^4 C' S. Ovar marqueeheight=25
9 h7 D3 s  p/ F! ?6 a- f//速度(1-10); |# X5 ^' T! q7 G9 @9 W7 L5 p8 P' h
var marqueespeed=3
% m/ e) y6 v) N# M8 v1 s//背景颜色
) w. `0 o2 H, N2 t' c! k( X. y) uvar marqueebgcolor="#FFFFFF"1 e/ ]9 g1 a& O9 Y" M% e6 _
//是否能暂停 (0=no. 1=yes)?
( M  p+ Y. `. ~4 Nvar pauseit=1
$ ]6 \+ g3 R! a2 T# n" z1 e
- {" Y0 w5 ?& J- `//修改显示内容) N) _+ ^9 E9 [9 c& O; o$ Z: Z8 a
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'  I2 h. w. T8 ?

# N# n) U; r- E% w+ s
6 G" D( p2 k/ }+ W. z5 W////下面不需改变////////////6 |/ {7 }. n6 s  D' d

  p9 }1 D9 w- ], F; R) g8 a0 Evar copyspeed=marqueespeed
# v9 C: b% q. p9 q: |9 S( ]var pausespeed=(pauseit==0)? copyspeed: 0* v. [( l# N: ~; ?. b  i
var iedom=document.all||document.getElementById
: V: T! }+ a$ z3 b' u6 Hif (iedom)
, n8 L: U4 N/ }2 z3 ?2 p5 ldocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')! `: y; y! S/ c3 X% u/ G
var actualwidth=''
$ ?2 g% L" }# i- Ovar cross_marquee, ns_marquee
2 R: u" T( O. i* A6 \2 s; c3 j7 q. n9 S; \4 @  {0 a' r% @% Q' N, u
function populate(){
4 [2 ]- ?9 G, kif (iedom){/ m9 s, d# f% s& [! o
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee/ ?: o$ `  E. y3 d6 B7 @
cross_marquee.style.left=marqueewidth+8
5 i, }% ?: k$ Zcross_marquee.innerHTML=marqueecontent
0 I6 W" \) G, zactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth2 G4 g1 Z* m2 p8 T$ A+ x
}4 b, }: j/ h( U$ V
else if (document.layers){
! o$ Z! [/ Q# [8 D8 J/ {ns_marquee=document.ns_marquee.document.ns_marquee2* n; L0 C/ e) d4 \1 E1 s. O
ns_marquee.left=marqueewidth+8
: c. x! W& U4 y3 n/ w# Sns_marquee.document.write(marqueecontent)
0 s0 V  }! |8 k- S8 Dns_marquee.document.close()
0 f* t/ l! ]: v! Bactualwidth=ns_marquee.document.width( v* i1 ?% s& b3 R9 x
}1 |, ]4 I7 _2 f7 E/ u& A: |
lefttime=setInterval("scrollmarquee()",20)7 v8 {: d" H- f4 o9 c2 k1 S
}. g- c# U& p) l  Y) r! ]1 C
window.onload=populate
( Y5 t  O! y0 F! z2 E2 K& h) N, {
# A. R, V: ]2 h: R$ E9 Jfunction scrollmarquee(){
& V, E1 N, `0 l- p. e, ^) pif (iedom){
0 T" T6 c: G3 N4 Iif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
" L( {1 ]. k6 ~! K8 ^/ Ycross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
$ @# u0 ]8 \) ^8 O4 V( ^9 }else5 C4 V& d& q0 U! d# d
cross_marquee.style.left=marqueewidth+8. ^+ K% c5 L* I$ D
) i4 ?5 l' R* g
}
% x7 a1 y( T" F0 I" zelse if (document.layers){& z3 v  q4 u  L5 z* H- U
if (ns_marquee.left>(actualwidth*(-1)+8))
. o3 Q3 S0 J* p- b9 Nns_marquee.left-=copyspeed) g9 V1 B9 _7 D$ w
else
1 j8 E- E: m- X# z5 ons_marquee.left=marqueewidth+8; l' W! I8 d: J8 T; T
}, q# o1 ?( {% l# E  P  X
}* c7 d6 o4 |7 [

5 r2 N! G# P! [) O7 p, Fif (iedom||document.layers){+ ]- O/ e( d4 t, J. Y9 ^3 L7 ^
with (document){# k6 h' I6 a1 i0 L5 K" S2 [
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')) |  I: q. c- t9 F) V' j( C
if (iedom){( L3 J9 n$ r9 x# T
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')  _7 T: Q! o$ F: s
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
# S3 k! w+ f6 E  e( x* _write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'). Z( i# r; G, k' V: z5 x
write('</div>')
! ~+ o% a2 V5 p}
8 F" {% z9 V$ w4 C4 N: f) u2 Helse if (document.layers){: U1 k8 X/ o% a# E; ]
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'), d9 F1 U0 _! \4 B+ G9 E& S$ D/ ~
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')' i+ X; U) N" _; ~, [+ `
write('</ilayer>')! f6 U* S( x. R+ J1 @' T
}
- M) W4 x4 _% Cdocument.write('</td></table>')
% E. a  q' _, `) N}( @8 W7 q1 n) L8 F
}& f: Q" S# o( U- I3 `+ s
</script>

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