返回列表 发帖

网页之跑马灯文字特效

//修改宽度
1 I8 g7 T+ Y4 S; N6 zvar marqueewidth=300
. Q$ M/ i0 T0 @1 J  p% k, X5 A//高度
, B* A$ s. s* \4 o" l1 n/ u+ nvar marqueeheight=25
5 W5 X& a% Y+ `8 L" ~//速度(1-10), V% h0 X; {* K! Z5 S( q- H% W
var marqueespeed=3% \( r, A' y+ Z1 i% H
//背景颜色/ }/ O3 V# Y: a; c; a
var marqueebgcolor="#FFFFFF"
+ E& R! F# y2 |//是否能暂停 (0=no. 1=yes)?7 M! D& Z+ l7 n+ ~' n
var pauseit=1/ b8 m, [9 d3 ?2 p5 C
2 L: q# {, _/ p
//修改显示内容  o6 M& F4 l8 Q# E0 ]% H) ]
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
+ S, V1 Q0 z5 |- g3 ]3 M4 R8 u6 {
$ u, p; P/ `) U6 j2 @
. H; [5 d; @9 O, }* E9 h////下面不需改变////////////; @0 Z: L9 U6 O

5 |5 Y) H) V, C7 [& y' W5 svar copyspeed=marqueespeed
4 t9 h/ G) x, @/ b& k0 Jvar pausespeed=(pauseit==0)? copyspeed: 0
! @3 I  a- B6 x4 a: ?$ ~2 pvar iedom=document.all||document.getElementById' `" P+ S& s5 y) T) Y) N" R+ b% E
if (iedom)& U3 [# S3 K% n" j  h+ I5 ~
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')  e0 C1 h. W* \+ M: g$ b5 E) J; w
var actualwidth=''
  H$ x9 M: W- pvar cross_marquee, ns_marquee
+ ^  ^4 m3 u' ~- g
$ e. s/ G9 U: v* H# |  qfunction populate(){
* D9 c- H( _7 u" F; Fif (iedom){
: O) A+ ^9 k3 z* t7 x4 `2 O3 ?3 l$ Gcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee! \8 u2 C5 V2 z' q' a* S" K2 u4 D% t, ^
cross_marquee.style.left=marqueewidth+8$ w- A" l) K5 q6 x$ |+ B3 Y
cross_marquee.innerHTML=marqueecontent
, Y+ _/ E6 {; t# c% ^# t: oactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth$ v: H, v/ v0 ~3 p$ S1 n
}% `2 b" E& K. w& a$ [) x
else if (document.layers){
5 y# [5 b& j4 @' q1 T. r( ?+ Q9 ins_marquee=document.ns_marquee.document.ns_marquee2
, }8 [! c2 j* R$ h* t9 B8 Hns_marquee.left=marqueewidth+8
( I8 {* l: r5 N. n6 Kns_marquee.document.write(marqueecontent)
& ?0 p- W2 S( J, z4 g% i! q* X; xns_marquee.document.close()
3 ?% c+ _+ g, J8 P7 f" r( Lactualwidth=ns_marquee.document.width
, w% A3 `1 j- a) {6 ^( {8 A* t% w}- U. }! [% a+ P* `9 ^( G
lefttime=setInterval("scrollmarquee()",20)% a9 ]* ?% ~- E3 X( t5 Z/ d% R
}2 _) l$ q. V2 U# y: Q) y6 T- o* T
window.onload=populate
8 X. k, J5 r0 X* }/ F
( ?7 c; g! @$ ]. c$ Q4 ufunction scrollmarquee(){
( u. y0 D+ V/ Z4 |4 \. z0 hif (iedom){! l7 C# h+ @, N( w2 j, A
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
/ q/ f- ^2 _$ I/ e# {. Q. Ncross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
+ [$ N# `* `- ?8 N( uelse
5 R- w# {0 W0 w" _7 g9 T5 pcross_marquee.style.left=marqueewidth+8
  d/ ]3 R1 L+ S3 F4 \# f5 p
* P* Y  e: A5 J, S2 a3 ?; B3 P) s1 f}0 p5 H; t: z6 U  j; P
else if (document.layers){
! l; a7 l4 {' H/ |$ O9 }4 ~if (ns_marquee.left>(actualwidth*(-1)+8))
( L- w& I" ^3 \8 y" `( fns_marquee.left-=copyspeed- G5 _6 m2 f! B) ]- t
else
, A, y$ T5 y2 [6 Y$ Ans_marquee.left=marqueewidth+8& {; [, {6 e  n( `. H, a
}4 \2 I8 w4 j/ x; K
}
0 J# W! V: t4 |
, G0 j% l0 K& D1 J  ]2 Lif (iedom||document.layers){5 f7 E; \8 O( N9 D) P% x# t" h
with (document){
$ J; n0 ], G" S$ o4 H  ?document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
! ~' S' s0 E, K- L0 Sif (iedom){
7 c3 |5 o9 W5 M( [5 Awrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')0 j* q0 [9 K# ~# s; r4 s
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'), }" {8 _1 u; J( d6 x
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')% {) f* C+ }$ ^8 @4 p6 G
write('</div>')/ v2 V0 [5 j: z) e8 T
}0 M1 |$ [& j: y3 z- j! S
else if (document.layers){
, x1 ?6 [# P( d) x/ P, S- m" Xwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
1 z* f! H/ o# f7 Owrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
( G6 V- K0 r0 Q% Ewrite('</ilayer>'); Q9 `! e& z' y2 Q
}4 z' \$ }' P* D* x% I9 ^
document.write('</td></table>')
" _3 A7 l" T0 k$ G4 r1 `2 H}
3 u' }3 u8 R# g}/ z# d! q0 Y2 G! \, B. W2 d
</script>

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