返回列表 发帖

网页之跑马灯文字特效

//修改宽度
1 V, d% L3 U; Nvar marqueewidth=300- O- k6 o  o. Z% O9 }
//高度6 T" u- @6 Q% k1 N
var marqueeheight=25; s$ C5 f+ l! \; q
//速度(1-10)3 L! t. \5 }8 {0 ~* ?
var marqueespeed=3/ K" F1 A* s: k
//背景颜色
3 u, G. D3 E1 c- Avar marqueebgcolor="#FFFFFF": I( c; _! Y1 f# a3 L
//是否能暂停 (0=no. 1=yes)?
+ h: n5 q% n' f2 N  fvar pauseit=1
- Z1 P8 }6 Y9 w9 ?
3 p& h+ B) g/ C8 p//修改显示内容' g9 S9 Q6 g6 f0 O
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
* h9 g# k, o: O- |9 S# T6 c4 T4 h  d1 ~6 S9 B
( |$ j8 H( r" d5 @
////下面不需改变////////////
2 H  [- F3 G4 K( ^5 f0 e- {7 b: S& ^4 p  D
var copyspeed=marqueespeed
! G# v6 V' c5 k5 o7 J0 |var pausespeed=(pauseit==0)? copyspeed: 0, z8 b# c# q. X9 E
var iedom=document.all||document.getElementById
: S7 u) k  n7 f# s% d- q" aif (iedom)3 D4 q& ~7 w# _, s2 J# F% M# t
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')7 Z2 e0 Z% o3 g2 a
var actualwidth=''
5 W! X9 @1 t, S6 Z2 ?7 gvar cross_marquee, ns_marquee% `; e4 h5 d: ^1 K3 E

# [# ?! E! b- p+ v- L% X1 ^7 Ufunction populate(){
$ M2 T5 P3 s9 [if (iedom){
7 \" t  r9 }& gcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee! z, E" M. o7 L2 h9 X, u! C
cross_marquee.style.left=marqueewidth+8' z1 b( K6 _% Z) d$ r3 P
cross_marquee.innerHTML=marqueecontent
( q) w4 ?: o$ H% S6 _3 hactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
0 q' B) X9 ?% D8 C9 q5 |/ A}$ x: E; `& V  Q
else if (document.layers){/ z5 C# J1 n4 S* {7 m$ ]2 M4 t
ns_marquee=document.ns_marquee.document.ns_marquee2+ m6 r# D& |6 X0 i8 T. R
ns_marquee.left=marqueewidth+8  t) j( H) V: ^7 g- `
ns_marquee.document.write(marqueecontent)
" j' Y- r1 F) E8 p! Sns_marquee.document.close()
! h( x' [' Y% _. }" E. f9 ~0 c! u6 h2 _actualwidth=ns_marquee.document.width0 [8 L5 |9 ^9 x5 y! A" g' k' I
}) U, o0 L( _3 l3 j  ^3 I
lefttime=setInterval("scrollmarquee()",20)
- P( P$ `: [# \' e}
) j! b6 q! M' k# u8 rwindow.onload=populate
" M% N$ Q. x. z, U- P
  z) [1 W  h" L; n' J/ r5 l; u( Hfunction scrollmarquee(){, E, _, T, K4 x. v
if (iedom){
: z4 h6 S7 r/ v8 L0 y) N  vif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
' K( G7 m& w  {# ^( m6 G. ?7 ncross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed3 B4 k: M) Z5 I7 E2 I1 i
else, V0 Z  f0 `3 ]) q% q# G
cross_marquee.style.left=marqueewidth+8# x2 [# R0 m2 j

  T3 L6 s0 o: U}
1 ?( \1 a  r) @6 welse if (document.layers){6 V6 p" x/ U1 o: S# P- Q0 `
if (ns_marquee.left>(actualwidth*(-1)+8))3 k& P4 T7 S- X6 e0 f5 B
ns_marquee.left-=copyspeed
5 n* u" n, b" oelse
. M0 m) _0 A8 ins_marquee.left=marqueewidth+8
4 W9 d1 t% B4 Q}
6 p  A" A# j* I6 p; ^}* A' w0 [) X, b( C
& [4 Q/ A5 Z8 j7 H: p
if (iedom||document.layers){
; ~8 i" K% q+ r* Z, r- Jwith (document){
. f5 h, N- t5 W- D% V6 k4 X6 s1 ndocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')3 b3 t9 r9 P: A3 [+ k  e& E! s) K
if (iedom){- P4 w  g4 O( N% z: m- r8 O2 f6 ?  x
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
' R8 `# s7 j* awrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
2 Q- g6 _* X0 y; {) K8 c9 z5 d( Ewrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')- J3 X+ f) ]5 j
write('</div>')9 I, y0 v" t# }5 {
}
, e, f5 V. G9 x! welse if (document.layers){1 ^! r% w: A. k8 x( z$ ~
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
" X8 h- z& k1 I# ~write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')" r$ E; ^' |" \7 \; ]9 ~: M! A
write('</ilayer>')( P) Y9 d- I6 r! p: r% f
}
0 U* N% X1 j1 Ddocument.write('</td></table>')
. L, J$ f0 f8 H  _- t! x8 A/ B}. j8 m" a0 I% T4 i7 \: G4 I, L- v
}
3 L' B$ c* j. r- J5 L( ~. o</script>

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