返回列表 发帖

网页之跑马灯文字特效

//修改宽度
" ~! B4 R; I& o+ V% Wvar marqueewidth=300
8 k0 X  z3 t) D/ ?//高度
" N+ J4 ]  i: _var marqueeheight=25, J1 R; a* \. {- p# [
//速度(1-10), N( |) F9 y: ]& R, T" x$ O  P: O: o
var marqueespeed=3- A: h5 ~& W7 Q( e* v' R/ v& n1 z
//背景颜色. E) r  q6 a' S
var marqueebgcolor="#FFFFFF"6 n, U& `. I5 M5 Q
//是否能暂停 (0=no. 1=yes)?; F5 D* c6 }% i: ?. z9 e$ `  K
var pauseit=14 y- C/ r1 X' R/ u! t8 E

, C$ J5 Y9 u3 \) B, k//修改显示内容
/ @2 B- c- z5 A6 Z6 vvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
% J: O2 Z( J" I
( a" S7 T. q# C. t. T
0 s/ i$ M  r8 \% |+ {- _, `, l////下面不需改变////////////8 R+ s5 Z1 [4 C, ^4 H6 `! i7 b

. S7 S# ]- m& z: P6 L7 z2 A8 @var copyspeed=marqueespeed' W: [8 ?0 O, e1 I& v# |7 S
var pausespeed=(pauseit==0)? copyspeed: 0+ l; w/ p0 S. C+ c. p9 j5 j0 T
var iedom=document.all||document.getElementById1 o# N8 t4 ]/ N3 ]  D
if (iedom)) }: c% D" a" ?/ y
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
% ?) L7 M0 @! E$ p  L# _- ]var actualwidth=''
- o2 e  K4 R* N6 @( A) Gvar cross_marquee, ns_marquee
2 K( Y+ A' b( L2 P3 |6 ^5 c5 Z# B0 d
$ |1 [2 |/ B1 Z- _& D; h3 k. ofunction populate(){
% M1 ~3 J* W3 d. p; K9 Tif (iedom){( N1 K& ?& k# n2 h0 n$ H2 Z
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
' ]. l. \7 _% a& R+ b! X1 xcross_marquee.style.left=marqueewidth+8
: G$ [; h" z9 W3 bcross_marquee.innerHTML=marqueecontent% F, h8 V! o& G5 @2 o
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth" l4 H/ C7 H, h
}
2 p, _0 O' Q  b- a! d' i$ n% e9 Relse if (document.layers){4 `% S% e2 K5 E' Y! D: Y2 R* h0 X  u9 |
ns_marquee=document.ns_marquee.document.ns_marquee2
: |4 C' X& ?- `2 {* vns_marquee.left=marqueewidth+8
" k; T( b# f) I* pns_marquee.document.write(marqueecontent)
7 ?/ G  J/ e/ S% f6 Q" ens_marquee.document.close()
/ a1 h# I& n4 h5 K3 s6 V7 a$ c: S  xactualwidth=ns_marquee.document.width, S( i2 y. Z% a2 ~. m* t* b
}1 G$ g2 o. w3 M8 t9 m. T
lefttime=setInterval("scrollmarquee()",20). v$ H, S! R4 S/ v! ?' E
}$ f2 O$ ]) ?; B4 u
window.onload=populate7 _$ J9 H2 ^4 t' p! S0 n" e
, B: Q3 `7 {$ N; ?
function scrollmarquee(){
8 i6 e7 O0 x/ c# P9 ^  T/ I4 Fif (iedom){7 `# h& X+ T! Z1 f/ U, ~
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))! |' o- ?& k  |3 Z( z
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
4 u" \1 V$ o0 E4 S: f1 x. T7 Delse/ |/ T5 S5 z1 ?- N9 H
cross_marquee.style.left=marqueewidth+8
+ |7 j. z# `; C8 |, X1 s3 P7 g4 G- o' j1 f
}  |$ B% N5 l/ T. @! N4 w, r5 T" L
else if (document.layers){$ s1 y0 m' k5 f. k
if (ns_marquee.left>(actualwidth*(-1)+8)): f4 j# l# a/ C" V
ns_marquee.left-=copyspeed+ i7 c: [# l* ]( r( l. C1 j9 O
else
- c' h7 q- K* U3 ^; R  ]$ qns_marquee.left=marqueewidth+8# d2 A- T* [# i" ^/ K
}/ S+ u. y8 P; B1 l
}( U& G3 |$ b9 A9 b3 G% H* O, B
9 e' q1 Q: y2 f5 D7 d3 R/ ?
if (iedom||document.layers){- X2 ~! k. G7 t+ h7 J+ K: g9 u
with (document){% y% L; O1 Q. q- D7 L; P( G
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
; ^6 y% e1 ]# q% Q+ z) vif (iedom){
9 N% }# \% R! {% Y; X: ?7 t! Vwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
" u& U7 U+ j/ P/ `1 `6 {write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
# B: O" _5 a3 Q4 w* _write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
9 u: |; _! H) P) v* kwrite('</div>')
" t1 `  @1 l1 \" p}' h. a' ~8 V2 I, T4 z1 g, B9 c
else if (document.layers){5 U8 _" b2 x. ~# E
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'); c, b2 c, J% A/ h( ^# g
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
3 p6 |) m, o; jwrite('</ilayer>')
: N* T( m. U4 d& q# {. y8 h" ?}7 B* ?+ M( o: I  p2 V/ X5 y; a6 M
document.write('</td></table>')% B. r8 p7 ^6 `5 ~, Q, y2 t1 B$ b7 J( e
}
0 c. {3 m* o/ T3 Y; P0 ?}/ Q- b- U; Y: v# ]
</script>

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