返回列表 发帖

网页之跑马灯文字特效

//修改宽度
# d3 \- {" A5 v6 S% l8 ~0 Ivar marqueewidth=300! c- G/ C3 M3 M% [
//高度" b! l8 C; S* @0 |6 q4 P7 m3 M
var marqueeheight=25
8 g  L4 L. p% O//速度(1-10)* j* q+ k  O/ g. E0 C
var marqueespeed=3
: k; ^3 Z$ B& J# P- Z/ j0 t//背景颜色
" T6 l5 g- N5 J( u& @var marqueebgcolor="#FFFFFF"
# i1 e/ |' ^! \//是否能暂停 (0=no. 1=yes)?
2 }1 E2 z9 E9 q+ @) M9 q& \/ X& z* r( Vvar pauseit=1
- Y2 u" G6 k5 t  m0 G3 L5 A
  o  ?$ N& v, C; q3 M. \8 y4 y//修改显示内容( s6 B8 k' N6 a; d1 w( y% c+ A3 R# Q
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
7 c# f, a9 X4 _6 i" Z$ |
* P, m5 {4 \7 P% A  p4 b6 N5 r+ h1 K) L6 h' R3 M- i
////下面不需改变////////////
( Y5 a) B. J- k
: g* L: j, ~: Y5 Nvar copyspeed=marqueespeed
, |" `$ H2 {0 f5 R) W% H, dvar pausespeed=(pauseit==0)? copyspeed: 0
& j3 l7 N/ G3 H5 a' m+ N; |$ Wvar iedom=document.all||document.getElementById
9 B8 s2 `, ^) o& ^if (iedom). G$ t: e+ B' j7 y; e  H) j
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
' V9 \. z2 c4 M/ K3 q0 g% [, cvar actualwidth=''
4 ]0 X6 k0 \/ k  g2 k% O9 s* vvar cross_marquee, ns_marquee
5 y* P, ?. k' p6 p
: G4 P& z' V5 P% efunction populate(){
" t. i2 l; E5 Y# G, B$ O, uif (iedom){5 z) a# g7 c$ o& |0 x9 M: _
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
+ t( ~+ P4 a& E8 b' }( l: {cross_marquee.style.left=marqueewidth+8( Z" a7 g6 y+ T
cross_marquee.innerHTML=marqueecontent5 O* S- \9 J$ H( y
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
' `  u8 C/ y4 c1 E7 H}
+ q9 P' W3 S( D5 T* Q8 kelse if (document.layers){3 y  p4 |( H  Y& _% l1 _# i
ns_marquee=document.ns_marquee.document.ns_marquee29 R) B2 i9 f6 P
ns_marquee.left=marqueewidth+8
% X$ d/ ]$ Q: jns_marquee.document.write(marqueecontent)  _+ v3 x, J; \$ ~( H
ns_marquee.document.close()
- A2 z" Q3 r+ }8 d6 zactualwidth=ns_marquee.document.width" v, p$ B7 A+ _
}. }% ]6 j; h  Z& D
lefttime=setInterval("scrollmarquee()",20)8 l% M; T# C1 p( P" C) E
}; E; o+ l, v0 u, K% J7 P) d' [+ V
window.onload=populate
' i3 h6 v* j1 C- Z* H3 G5 \4 I3 F6 A" R1 b, j. l
function scrollmarquee(){
1 M" C( K9 V: bif (iedom){% |4 c& F& p: ^& I# B8 {# G
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))3 J9 d1 B2 m+ U
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
- S' {* V3 m8 p! m* \5 K" zelse. U0 r/ k: c1 ?( z; q
cross_marquee.style.left=marqueewidth+8
& g5 H+ _4 X, ~- g
8 d) t, S( M1 \2 C1 K5 X& G9 M}1 l# J5 `1 K' h4 t
else if (document.layers){
" a' _5 `) W) ~if (ns_marquee.left>(actualwidth*(-1)+8))
9 [7 Q7 ]& H, f; }2 Vns_marquee.left-=copyspeed, c% J  c% ?) i0 o1 G4 @
else7 ^+ L: y  R/ ~
ns_marquee.left=marqueewidth+8' A& `4 p  l/ p+ N4 Y* J
}
5 b# E4 t- b5 l# y! E3 ?4 i  `}/ U* i3 y% l  z

/ u4 o' D2 H$ N1 r5 D6 dif (iedom||document.layers){
! [" A, q6 r& Dwith (document){
, q- z2 D$ b* q; wdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')  a( T+ Y0 V, e) M' F8 F
if (iedom){
- f% P3 Z$ ]1 Gwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
' O0 H0 A/ v3 lwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
# u9 k: B2 a, o% {write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
' W/ Q  Y" B2 T+ e5 E& nwrite('</div>')# B- x6 M, b# F
}
3 w6 X' e) m) m; o* c6 n6 Q& Jelse if (document.layers){
3 Z$ W# Z% I1 vwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'), m: d3 I# g) F7 k0 c9 r% Z
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
4 d- U# M+ l) z5 Vwrite('</ilayer>')! C) b7 k, E3 c  z! N( w
}6 _/ n/ c" d5 f9 v
document.write('</td></table>')
6 e7 w# }1 V6 x1 U4 n! u( b}
  O8 T: @4 S9 s2 Z1 }! ?}- K- c1 y+ i$ O8 [, N8 B) i5 J7 @2 H
</script>

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