返回列表 发帖

网页之跑马灯文字特效

//修改宽度. `, X" E! `, r8 q4 L, _' ]
var marqueewidth=300
+ k% |( g0 W& @* f//高度
! w" ]5 X8 ~1 f; Ivar marqueeheight=25
+ e' R- ^# r! S) m* i+ A' s/ u5 [//速度(1-10), _, O( D6 T; L; D. T0 r; X
var marqueespeed=3
- E$ I; D: M) P( M7 l//背景颜色
+ {4 {7 }2 c; ?$ cvar marqueebgcolor="#FFFFFF"4 q! K6 i, s* t  i2 B7 d+ r
//是否能暂停 (0=no. 1=yes)?
6 J! {$ S  p, |; Z& P: ovar pauseit=15 V" o- p' r( K0 _% q, x9 p4 U# x$ M
% c) E3 V( K$ ], r* V! s8 j
//修改显示内容+ \1 R+ }( o. }: D9 v1 D( h
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
& ^  U5 j  n5 k7 n1 B( H/ e$ v' v' S2 P/ Y9 h4 F  b

8 V: E3 t: Y2 v////下面不需改变///////////// y: ]0 m' g8 p. e% [4 B

+ s9 ]& U, E2 ^7 J2 N8 U6 c7 ]var copyspeed=marqueespeed
" {& v4 e) Z8 }var pausespeed=(pauseit==0)? copyspeed: 0
! _$ }1 R) I" b! n) }6 x# Pvar iedom=document.all||document.getElementById; R2 }& p- o  k: W& V% ?1 C
if (iedom)
1 T7 ]2 x+ j1 I4 k' vdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'). Q$ @/ H1 o1 w* N% U2 a- V9 }
var actualwidth=''
7 h  \' \/ B2 r, U5 v- Mvar cross_marquee, ns_marquee8 C8 ]' [+ Y1 S0 ~8 T' u
& l$ c" h5 @/ j/ `" M+ S% M
function populate(){
- D* R; x* H1 i. N, m: iif (iedom){
8 J3 @! G9 y% A: O7 Tcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
8 J8 O( _7 u6 Fcross_marquee.style.left=marqueewidth+8( ]3 |1 l2 G( d3 l5 ~
cross_marquee.innerHTML=marqueecontent
: I8 _& B# Z+ k4 ~1 Y) Y1 [; n" Vactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth. W2 G! D3 w( t
}
5 r; K. G+ c7 ?8 P& D7 |0 melse if (document.layers){. S1 l& J' Y5 U, w& \( g
ns_marquee=document.ns_marquee.document.ns_marquee2% N! H7 `1 x. L; ]( d8 _
ns_marquee.left=marqueewidth+8
  x) v- q( I6 [. ^; Kns_marquee.document.write(marqueecontent)5 ]+ ]2 v3 M. `3 g
ns_marquee.document.close()
) f- \* s1 ?3 e- G! Ractualwidth=ns_marquee.document.width
/ x* z( z6 _/ H0 X' d' [}
; f2 {# z" S0 _/ u; ylefttime=setInterval("scrollmarquee()",20)% [# _4 I. R: \9 O
}
2 b, ?0 q4 P$ K& U5 B# Rwindow.onload=populate+ v+ E' j: n0 h7 s
$ N8 f" N5 @. V7 U4 {1 y
function scrollmarquee(){
  D+ d" i+ N7 ~3 I5 m- iif (iedom){- T' o% \2 S  j2 Q
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))8 K( B$ F! R2 C6 u+ l  e4 P
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed0 a, S( x6 K$ r- m) k: i3 K
else& s& z- ?3 _; B/ _9 t+ m
cross_marquee.style.left=marqueewidth+83 a6 y( D& h) m
$ o! ~% k8 y4 q
}
3 v4 G! W6 P, j# Q3 K3 N6 Q2 C' pelse if (document.layers){
: ^% C8 ?. l3 H5 M1 C7 ]4 y7 Hif (ns_marquee.left>(actualwidth*(-1)+8))" l* R6 C8 j0 o, V* z
ns_marquee.left-=copyspeed
7 w# }' [  D/ j5 y% c1 q/ G  r8 pelse
. p, O; F6 v7 \, I; J# B% ons_marquee.left=marqueewidth+8, d; m) m9 F3 x0 D
}
6 \+ d0 F* s7 O/ s- K9 R6 r; t% V}
" ^9 u6 W/ ^5 _. |# d( o/ v8 m7 y, z5 y0 O  E8 O
if (iedom||document.layers){
0 m' F1 e7 h0 X& M. X4 Xwith (document){
; B4 w' e3 n+ f! i+ idocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')+ [+ L3 L# }# C9 [3 [
if (iedom){4 c* I. ?( Q& L6 I( d
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')# R# W5 E. Y8 L1 q1 @" w
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
% J' D( K. y6 _  b+ ]( hwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')7 l1 x* C5 F+ z$ d* L* R/ M# i: h5 r, x
write('</div>')5 N7 s- F' X# t  H0 U
}6 i2 p4 `1 ?/ s" S
else if (document.layers){
, O- H& S1 }+ _" k8 }write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')  `( R; m- ]% g5 L/ I
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')% ^- E' l% v2 F5 V# e4 K
write('</ilayer>'): t% B* h7 O$ S
}$ }. k* e( `9 R" w" ]- u" F+ L0 i9 b
document.write('</td></table>')) V; G! V% V9 [+ V
}. N( a& n/ S* @" S
}
3 }! [$ N6 B# k2 Y5 |9 N, J" F</script>

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