返回列表 发帖

网页之跑马灯文字特效

//修改宽度5 F  M( Y6 a1 g, k1 I
var marqueewidth=300
, N) b+ Q3 O& _" f2 g//高度
3 c$ G2 ]5 o7 W4 Y" Qvar marqueeheight=25. F9 \1 g. b  P7 ~, e
//速度(1-10)
* Q) I1 L% s( B: I9 Rvar marqueespeed=3. ~# g. F# \4 [- ]. u( {  S6 |
//背景颜色
! O& S: G; _- p" K" cvar marqueebgcolor="#FFFFFF"' @: \. d+ x  E& m0 Q1 ~$ G4 h: G
//是否能暂停 (0=no. 1=yes)?
$ Y  S9 M$ D* z! _7 u" l+ ^var pauseit=19 f5 r5 T0 s3 o
6 {- ^7 H$ b% Z8 i$ j8 z! U
//修改显示内容
7 W6 X1 S  T: U3 F+ E# V8 a/ Rvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'( W0 T2 n8 A. _- B* S

. t! c' r4 m2 Y- H( H. z% ?) s4 D* U4 |7 A9 G/ u" ?) s2 S
////下面不需改变////////////# }3 a* n9 j* g5 ]) d

0 K- g' |2 y5 a' i1 vvar copyspeed=marqueespeed
$ g4 }' i# N+ {+ K+ x0 J5 `var pausespeed=(pauseit==0)? copyspeed: 0+ k" ?& N& E0 L9 }8 ]8 y2 ]
var iedom=document.all||document.getElementById
6 t" J1 d! K' k( |if (iedom)  S' p3 S" M0 d# k3 T
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'); P) i) [7 L+ f8 P" Z
var actualwidth=''- C+ D" [7 J$ d0 c. |
var cross_marquee, ns_marquee( F- @. Z8 b+ u8 k

# \3 |0 D# \6 d4 |function populate(){0 }: N( K. h+ |
if (iedom){
4 u6 u: Z" v- G  e5 \' ^1 Icross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee( V( T; l8 i, }4 @/ _
cross_marquee.style.left=marqueewidth+8
# w6 u5 I: d1 X- Q9 u5 G0 c/ }cross_marquee.innerHTML=marqueecontent
0 T" Z0 M+ h5 |' c) mactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth' K$ T! R7 d9 P
}' G! @  K, E1 `, t$ w
else if (document.layers){
9 z. v# v5 z2 O6 Q) n% Vns_marquee=document.ns_marquee.document.ns_marquee23 t7 e- O1 q* C& ?
ns_marquee.left=marqueewidth+8
- z/ `- G0 V( R. B: Y0 e  h+ {3 e+ Ens_marquee.document.write(marqueecontent)
' M- e+ N% a: c( bns_marquee.document.close()4 P0 [! f2 h4 [% ~+ R4 h
actualwidth=ns_marquee.document.width% k( T& c& t- m# R% y0 \
}( W0 \: }7 Z( \+ t
lefttime=setInterval("scrollmarquee()",20)' c5 e* a5 b! i$ g1 V
}( K# J0 D: g6 z' m: @& k, @
window.onload=populate5 F. W: a$ [% M; _8 N8 y% o$ l
" y; Q% R, P* T* W3 ?% \1 {% a3 E- c
function scrollmarquee(){
, {5 U6 y% F' H4 }if (iedom){1 p% l8 n. C. o) t1 \
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))4 G2 G9 `4 {* u( F# T
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
0 q4 h# v6 \+ \( D/ x( ~8 d' ^7 Celse
1 r: Y" A8 Y2 ]5 Y2 n7 Hcross_marquee.style.left=marqueewidth+8
: y# x. ^3 H( X0 S0 U2 b. z' j
- o1 g3 Q+ G, W7 s( p}# d6 Q: C* c" Z0 E9 u
else if (document.layers){; `& |, ^& K  T# S
if (ns_marquee.left>(actualwidth*(-1)+8)); E+ N) |5 n4 v, d: r; U; b
ns_marquee.left-=copyspeed# O, V5 Z7 Z; x! e/ H
else! |% \% ]7 K7 S: [3 b
ns_marquee.left=marqueewidth+8% _6 f' d+ t# \! s' B7 o- T% w! r  E
}; P3 F* X$ r1 \( a0 g6 \- t
}' F% X" K! `0 `! a& I
8 N; ^' A3 m$ I! @0 |, D0 o
if (iedom||document.layers){/ n1 X5 f% @. A- q
with (document){1 g( K- W. H4 g) _! p9 Y
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
% Q6 Z% y) V4 G4 L3 Xif (iedom){
6 s! X! B; r) G# g+ p2 l9 t  swrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
  `8 a+ ~- O8 i6 @) ^+ bwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')0 }; v; C( r+ N% I0 |5 P8 G" e
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')1 R2 V2 [  U0 i: }
write('</div>')0 v1 t( G9 ~1 h4 i( Y# J
}0 {8 n8 R( N+ ]/ d5 `- F) }
else if (document.layers){
1 z" o0 }" m; V+ [% m8 Wwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')7 Z, g: U8 k+ G5 C) x" Q' E
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
  q' h! b3 a- Ywrite('</ilayer>'). ]8 J6 I! d, K4 C
}
! V, m* ]& C# q4 qdocument.write('</td></table>')
9 H; u- J( E( b}& Q4 Y: f8 X7 {6 c# y
}6 g9 }3 M8 U! M0 U! k8 F
</script>

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