返回列表 发帖

网页之跑马灯文字特效

//修改宽度- d3 r9 g- w# j7 e. G- l
var marqueewidth=3003 t3 l1 b, t  }7 n. j  d
//高度
* G/ S$ {' Q5 y: O4 Z2 U4 Evar marqueeheight=25) r1 J( k) C. W! J0 q! D6 e, z) O
//速度(1-10)' o: ^8 A6 _( ^' q6 c
var marqueespeed=3
! ~' ]+ s) I% Y# l6 L3 {//背景颜色, a8 g8 t$ V( s* @4 Y# K
var marqueebgcolor="#FFFFFF"
/ _( d  S0 ^, y! T: ]) ^//是否能暂停 (0=no. 1=yes)?7 V/ U5 {; \8 d5 g0 B0 A# m
var pauseit=18 P7 }, _1 ^, |# O3 k0 ~0 F$ L7 s% t
# a/ k) u, A2 T# E9 X5 I2 ?& Q9 u
//修改显示内容
! o+ t0 q& ^6 Evar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'2 u: t% q( j  d2 e7 b+ ~
/ N" [' S! m, Z5 k
- ^# ]+ x- v( B* `- d
////下面不需改变////////////
  O2 d1 z3 Z$ {+ ]8 }9 Q3 ]- g2 Q& g$ {! @
var copyspeed=marqueespeed# H& y& X3 i( L5 j  n, ^* I
var pausespeed=(pauseit==0)? copyspeed: 04 n4 t+ O; j; u" w3 M0 \3 r5 v7 d
var iedom=document.all||document.getElementById. U" [1 D5 E# Z8 S  I9 {1 ?
if (iedom): B) q$ b+ v) U4 e" \
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')% D5 i0 c- x  k8 A+ f; q* y, E" u
var actualwidth=''
) S! `( k: l& L, Zvar cross_marquee, ns_marquee
4 u- w1 G( o8 e# D+ j& H  N  M: D: B6 t2 F
function populate(){
9 B* n9 v0 \$ @1 [# }if (iedom){+ d$ R' h. ~& o: }4 L0 D( m+ T
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
# b. ~) s! `/ j. I/ }- scross_marquee.style.left=marqueewidth+8
+ @4 R; v: v9 K+ J6 G4 }" Lcross_marquee.innerHTML=marqueecontent& M0 l* L/ L" F& O# M
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth" H; C  W% V. j  M6 `. l9 a, o
}; M) x: s6 O& U* Z
else if (document.layers){
0 w3 W- q) D( c6 Ons_marquee=document.ns_marquee.document.ns_marquee2
+ U- ]: r1 _4 n+ pns_marquee.left=marqueewidth+8: a$ J3 s4 a: x; x  D% O8 K; p
ns_marquee.document.write(marqueecontent)
5 T4 b& o/ @' j+ g6 f" }4 V* r8 I1 Wns_marquee.document.close()4 W2 M& H3 s; h& ^- c% Y' c
actualwidth=ns_marquee.document.width
$ s4 b" `" G& |& g, n}( p2 E( R" O: j1 I
lefttime=setInterval("scrollmarquee()",20)4 B7 a2 |7 C2 m, g$ c
}
- B5 A3 n2 w; c) p9 u% Gwindow.onload=populate  [. A- X9 m8 J
* t. Y/ U$ m  O8 I% ?3 K- l( Y
function scrollmarquee(){
1 B  ^; g+ g! _0 T6 Iif (iedom){
. D0 M3 o* S/ m3 q$ Z5 Gif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
% W; h$ K7 X% Hcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
. u3 {; J  `4 L4 b% qelse8 _, \* u6 x! g% G% D1 t" }
cross_marquee.style.left=marqueewidth+83 _/ F2 P+ C9 W* Z. D5 b

5 S: B5 q% F; j: `# O" w}
% b) M) T( M" w9 u. d2 felse if (document.layers){
0 A5 c! V- ?/ H! n' o' v" eif (ns_marquee.left>(actualwidth*(-1)+8))
) q- k# u3 C& n+ t3 C* Q3 bns_marquee.left-=copyspeed1 p# K. Q2 ?8 M' x. O
else
* |2 a/ }5 k9 \# D- `ns_marquee.left=marqueewidth+8  D. n- T' b* P  W# ?) y
}# Z* v3 a! ~1 e6 V
}
2 n7 T, A" `- R3 ^. g, p
1 L" Z; Q" }7 W: L  y& d, N& h+ bif (iedom||document.layers){  ?( ?4 R2 J  H. M# W5 p( ]
with (document){
/ U- ]/ {) ]+ \6 }document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')  v% n) B( V6 c' ]0 y6 x8 q- I
if (iedom){
1 `! j8 C; d4 s7 F  Ywrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')% L# l+ z8 S/ c, Z& t* a/ o
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')& \3 P- |- O: ]7 o- l6 Q& M
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
" G( Z4 g4 z; s. u; ~1 rwrite('</div>')
$ ^( S1 K* t2 l+ J0 y4 L7 \$ Y}
, r  {8 y$ g/ @: b% o- kelse if (document.layers){( Y' Z( i1 [3 l9 Q. J
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')2 |/ B! d8 T* V5 ^# w% Q, K) R+ ]7 u( X
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')8 @. \( j. X4 V7 k# W1 }6 E5 H# S
write('</ilayer>')
0 F) p7 p) K4 x) n, t}5 O; l& U- l# u; E
document.write('</td></table>')
' ~; R) T8 u- {( W- d! y; g/ u, q}
3 V7 ]4 K- Q1 w* G! b) u}& M; `! W, `- r8 X( @7 L+ G% X' F
</script>

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