返回列表 发帖

网页之跑马灯文字特效

//修改宽度
7 q4 y* E1 `5 _( q, ~var marqueewidth=300; [/ m  R* V; K, ?9 a$ {
//高度" @2 N& ^) e# G
var marqueeheight=25
4 s" |' d( ]1 q//速度(1-10); B4 N. d, i$ V# J. k2 y! N7 d
var marqueespeed=3! o4 Q9 [' T' k2 K0 j
//背景颜色
9 O  v* q0 Q% d# F& L0 g7 rvar marqueebgcolor="#FFFFFF"3 \2 C6 t5 x  J' ~  B
//是否能暂停 (0=no. 1=yes)?
4 U7 @# C( K* g- gvar pauseit=1
' j0 l' P2 Y/ u0 w" H. t& S) k
! v& U) m9 |8 h, X/ p//修改显示内容; u4 Q+ ?; }  L; i6 i: S- J
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'7 M, z* n* Y5 v, q- v4 V" I
! ^% W9 H- I# ^5 ?0 m* k; T
- u' _# w  t2 c
////下面不需改变////////////
" g+ s. ~, [8 U- n7 p
' s! s- l# n' v+ cvar copyspeed=marqueespeed
% Q% F/ o, h$ S, bvar pausespeed=(pauseit==0)? copyspeed: 0
1 p& p0 R! G: `# ~: ^var iedom=document.all||document.getElementById
0 a9 {# x$ k' v% k" D, vif (iedom)
: @0 j/ E5 e( R7 z  J6 j9 Zdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')7 t3 v9 a- _* e. U  J% F
var actualwidth=''
$ X- y: h+ G& {$ w  _/ _( s+ [var cross_marquee, ns_marquee
$ t6 i( }# x- V0 T: e. r' e: U, M5 p$ h9 ]4 g! o2 m
function populate(){
0 f: a5 Y7 _2 k# gif (iedom){
9 i, P2 k% z) ncross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee" l9 W/ W! d! b! X& b
cross_marquee.style.left=marqueewidth+8
+ }3 V0 Q6 u* g5 Y2 `2 E  I# scross_marquee.innerHTML=marqueecontent
7 k  r( ^3 J; e. Uactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
5 Q. g: |7 V. y}3 S/ \$ m. {& q+ q
else if (document.layers){
6 D+ K: H- i1 b+ C! G6 Kns_marquee=document.ns_marquee.document.ns_marquee25 G: Z$ O5 j9 N+ t
ns_marquee.left=marqueewidth+8
/ W% ^8 s) K0 r! f/ W+ v; @' tns_marquee.document.write(marqueecontent)
$ u$ O6 B. o$ qns_marquee.document.close()" j5 J  V' m+ J' H$ G4 @/ z
actualwidth=ns_marquee.document.width, ?$ y+ B8 O5 V, m  o. k6 r  q
}/ M3 D2 T) R1 D
lefttime=setInterval("scrollmarquee()",20)& Q6 Y% u, a. s
}
  @8 d$ T4 s& y( M7 p9 A+ J$ Jwindow.onload=populate
- z7 i" g# K& s. r$ `# Z1 _+ s! Z" a# [
function scrollmarquee(){
. F8 L; h; M4 X( A- Pif (iedom){5 u1 p1 V; ^  W
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))/ i, Z; ?: @" E* |, {
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed* T# z4 ~( I" J3 s4 S* M
else" J; }' }& ^& g& h& i& [' H) S
cross_marquee.style.left=marqueewidth+8
$ s# I# n( h( i# Y# Q9 b/ _8 U6 ~* l  g
}% E3 [' q) a, h" w, u
else if (document.layers){
0 N8 v% h2 P( {7 B7 |3 E% ^/ Xif (ns_marquee.left>(actualwidth*(-1)+8))
) c* T. h3 B' H3 }* p% g( I- f% V6 Cns_marquee.left-=copyspeed
# e+ G( d: z9 K/ |  Belse
( B! S7 Q- k+ Yns_marquee.left=marqueewidth+85 ?. g" n4 C1 v* K
}
4 ]; ^2 |' R/ F9 i" @7 ?5 w$ \) K}
& b3 E5 {. f/ I3 y6 _8 f9 q$ ]8 l8 S. m- u) L# C
if (iedom||document.layers){
* a4 t0 ~8 A$ W* c) ~3 Awith (document){) c5 Y. ]4 J9 d1 ?! P
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
7 F2 X# q; U6 H. p) q0 n( [if (iedom){
2 c0 E# M. |" `write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
5 u: |! n3 q2 i$ c( hwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')7 }5 o5 W1 h1 r8 p6 K
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')9 K" `8 c, T" P0 ]
write('</div>')
; W. o3 O7 d6 j. x/ N/ j}
8 K- k0 g0 ?7 T# [4 velse if (document.layers){
! r# N! Y4 F! Q; p! y5 ~4 M9 awrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')0 B: x4 t) F9 B) U. R( r
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
! x3 s2 |/ Z( A& Zwrite('</ilayer>')& v  e" m% N( u. @
}( {0 v. p- A! W8 B; F0 R
document.write('</td></table>')9 F8 o. ], G4 i
}5 s/ d8 q* ]! E
}* J$ V; X4 x+ S* O& v: a
</script>

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