返回列表 发帖

网页之跑马灯文字特效

//修改宽度9 [9 m. H8 h. K3 e& t7 O. E! C
var marqueewidth=300
6 {! \( R5 D: q! Z//高度
+ u  a4 n( u! a. C7 l$ Zvar marqueeheight=25
* h. L' D8 m$ x# U8 m//速度(1-10)
0 i% u! {0 b% L# ?' i& ]var marqueespeed=31 \5 A3 X5 L) X3 f1 v( X- ?
//背景颜色; y2 W3 |$ x) A, J" j& H( m
var marqueebgcolor="#FFFFFF"; k6 k$ W+ ^) ?5 Z" N$ W% J* W
//是否能暂停 (0=no. 1=yes)?
. `7 S5 k! }4 R9 Q9 Q. m2 Xvar pauseit=1
, ]2 _' [( R7 ?7 m
1 v. i6 V0 I7 i. {4 y& `0 ]//修改显示内容
9 t, q+ {8 w+ D0 p. u3 y2 nvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'+ y4 n4 p( x/ O
2 R7 N* a$ S. E1 \

# I5 K1 u- k- j////下面不需改变////////////. g; f/ G  M# J% o% q% H
2 M# l2 K& ^/ k6 F7 a; w
var copyspeed=marqueespeed  C* _" r3 r& p; ?  S# @
var pausespeed=(pauseit==0)? copyspeed: 0
  E; S  U9 t+ l; X; \var iedom=document.all||document.getElementById% G5 z2 h4 y, P1 `
if (iedom)4 i1 S$ w3 _$ z7 {' Z5 {8 S
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
8 ~: v9 f$ z6 ^8 s3 s7 `" U0 L" wvar actualwidth=''" u8 o: k! d8 w! p
var cross_marquee, ns_marquee! A, C: e4 V; `& o+ A' T( C7 X

$ X, f$ k' \3 ]% W# P6 q2 u6 gfunction populate(){
/ W! i. N3 l' A7 [* wif (iedom){, Y# p0 |# d- H5 `
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee4 V- Z& f" I; p
cross_marquee.style.left=marqueewidth+8' M* R( a- r& M. @/ N  M5 C/ _1 h
cross_marquee.innerHTML=marqueecontent! v( E) i- E) g3 o' O7 e, e4 K
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth8 L: E3 s# T# ^3 f2 K5 d0 M
}
" N0 A/ i9 b7 O; Y9 }3 R3 a2 Jelse if (document.layers){; C1 t8 S7 Q( F. x6 o! [0 i
ns_marquee=document.ns_marquee.document.ns_marquee2
5 ^0 B/ M2 K2 @7 I0 wns_marquee.left=marqueewidth+8+ v! X0 Y: H& {' Q7 S$ S0 s! j0 K* h
ns_marquee.document.write(marqueecontent), K7 R0 X+ z' H' L) f" Z7 z
ns_marquee.document.close()
+ u2 A2 P/ h; w- u* k- _actualwidth=ns_marquee.document.width' ^7 s3 c/ I1 [  F' O& c/ c
}) N$ I% i0 ]4 p; C
lefttime=setInterval("scrollmarquee()",20)3 B$ J  `9 J, a) {2 \, ]6 |
}
/ O$ Q, ~  Z1 V* K, m+ i: k9 Dwindow.onload=populate
1 ^3 D& O) k, ~: p
5 T& _: e9 ?* G7 v1 ?+ r- n. |5 q6 B4 dfunction scrollmarquee(){
! x" w$ ^/ K+ _' A; Hif (iedom){
: S8 G! e# N% Z+ q5 v6 q. vif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
* G+ F$ J4 [3 ]  U1 F8 Kcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed! F9 I' C% ?4 n: l0 U
else( |3 j# e! K8 j; {6 S6 }
cross_marquee.style.left=marqueewidth+8
9 E2 |$ r) W6 A- B8 ^7 E7 ]0 H" [
- O/ T6 Z" R% h2 d7 L' d}
2 b8 d- C$ O+ u; C( K1 {else if (document.layers){' q) F7 H, M- O0 P# g! y
if (ns_marquee.left>(actualwidth*(-1)+8))
7 a% Y! _- [, G: {, c" xns_marquee.left-=copyspeed
0 [: t: t' S* A9 B2 `7 Jelse
0 L4 v* Z; E$ W  o' O; T* q( _ns_marquee.left=marqueewidth+8
4 b6 m% j) k* L! O8 w8 p+ T}  _0 v6 I& T  I
}
6 t1 I$ U2 w$ w3 Z! k2 _* f, J5 }# F2 K+ i1 {" g% s( r
if (iedom||document.layers){
' y( a; @5 b+ W, A8 L  s, n# s, zwith (document){
3 W$ L4 s& r# i" u9 e, R, z) \document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
, |  y: d# u9 O1 f9 yif (iedom){. |" L' z+ w" L3 ?
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')8 q) ^, O  r; [2 m
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')+ [) k0 r  g; S4 d' f
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')+ T8 z. w$ Y" f7 u
write('</div>')% l( ~( U8 n* B5 R) Z
}
$ ?1 a! T7 T  R- v$ Eelse if (document.layers){- _, l, Q; `- j: L9 e
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
/ M. m7 X7 Q) M! Kwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')' P1 h: R1 q" S9 x0 W8 j
write('</ilayer>')
: ^: ^, [5 P& S% |  d}! E5 G" k/ D5 G
document.write('</td></table>')
# n  m) ^/ e2 l% J% L) E  Q}
9 }) n2 V& d" A& k. M% @" a# g# P}, @/ H% z5 x0 ~2 b
</script>

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