返回列表 发帖

网页之跑马灯文字特效

//修改宽度
) J$ o1 ]! w% k0 D* j7 }0 fvar marqueewidth=300
3 j$ A- l9 S0 x6 e  {; q' `//高度
7 i" }- a" |1 i7 O1 k! vvar marqueeheight=25
% D6 s( h1 m; t5 l/ d//速度(1-10)
* o+ |" F" z! P% o8 E$ Tvar marqueespeed=3' R6 F/ f4 b# h7 ^% l
//背景颜色
0 B2 Z/ s% A1 N7 K& V, uvar marqueebgcolor="#FFFFFF"
# Q/ K/ P1 G# ]' O  p8 \//是否能暂停 (0=no. 1=yes)?2 G$ g+ L1 Q6 g! v+ m4 w
var pauseit=1' V: F2 E; N. ~. f2 P
2 t0 `7 I0 V7 `- S, O+ i- b- m
//修改显示内容% b, E' l' Z! i# {: a
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
# i! c$ [7 h8 C' z3 h2 M( e0 p$ v/ L( R
1 f! ?! D4 M0 D4 T% q8 o1 N( C1 s; Q4 S6 n6 T0 m
////下面不需改变////////////: U) H) f3 B: c* R7 x' t( e% b

# @$ y5 x6 ~4 N+ e* I5 ~var copyspeed=marqueespeed
! t; z4 n" o: H2 h1 Y9 \* zvar pausespeed=(pauseit==0)? copyspeed: 0. ]) E2 u" I9 C% _
var iedom=document.all||document.getElementById
. e% I+ }& r0 ]* ~if (iedom)
: V% X+ J1 z  g0 R1 Wdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
$ R; R2 I+ m  O/ Dvar actualwidth=''
; J& t/ i: ~6 m4 ~( Lvar cross_marquee, ns_marquee! h+ K( p7 H0 J& D

5 y! T* K& Y0 C9 [. ~5 yfunction populate(){
$ E1 C' @$ G) Q; _6 g. ~" Kif (iedom){9 e4 L" A+ n' X9 p
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
0 r$ ~/ l! B5 Z+ K$ h) `* P3 X6 Jcross_marquee.style.left=marqueewidth+8
* ]; g) x- o' ~( h" c4 k& Across_marquee.innerHTML=marqueecontent, ?  ]! s9 m+ L& b# U$ Z
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth6 g1 g# m- _8 ?# m. R1 R; C- Z
}
$ q3 E" `( d9 yelse if (document.layers){- l! i4 D! Z9 d+ A8 y' j
ns_marquee=document.ns_marquee.document.ns_marquee29 v" q, H. x9 K% z7 D5 c
ns_marquee.left=marqueewidth+8. S8 Q5 R' S& a1 e
ns_marquee.document.write(marqueecontent)2 Y) h& M& @" a' [  l4 v+ @) ?( Z
ns_marquee.document.close()
4 l3 a$ y! |( A" K- Bactualwidth=ns_marquee.document.width$ h3 E% S# W3 t  S, s' Q* x9 X
}
, A, ?1 J% {3 E9 y! j; `% g! i/ w3 ~lefttime=setInterval("scrollmarquee()",20)* c3 P* [3 g  F  D
}+ d2 D3 o, d; A- P+ }
window.onload=populate6 H. T3 _% C! F& e% B3 ?9 b) D
' Z$ P8 K- U* f7 h4 U* z! F& b$ l
function scrollmarquee(){
: o/ F* f2 g/ m9 F; {4 gif (iedom){% [5 m, ^8 P9 N7 y# Y
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
0 u. m( C, _  d" J8 Fcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed( A6 E$ X, b0 A
else) I' K5 ^4 ]* ^
cross_marquee.style.left=marqueewidth+8
3 M1 |; m* e# f( e. m7 m' Y
5 j& t0 F& z6 n! m% L9 s}) r! c# g, C: |) W( Q7 H4 r
else if (document.layers){
, L# P" H- J) c/ b0 r4 nif (ns_marquee.left>(actualwidth*(-1)+8))4 r3 D) y5 t( R& K8 ^
ns_marquee.left-=copyspeed
" d' l) ?  r" B: N( d1 o( pelse
% L. n$ s' [" Q3 U! xns_marquee.left=marqueewidth+8" Z3 i: m! W- m- e- N8 _1 L
}3 v1 v' e1 E- ^: [1 L, }
}
& P8 J/ [  ?  w
) n/ m8 [3 B; O5 k/ Dif (iedom||document.layers){
: \) |# ?) p7 f2 U% [5 Hwith (document){
; x0 p, t' Z( f, Vdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
3 a& A3 g1 d+ g' `if (iedom){
5 R/ v& I+ g- C* Y5 @write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')3 x0 I, \/ F, j$ G! `  E
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
+ X/ W7 K  K! t" b' Twrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')3 f8 }8 Z' s" [# S7 ]  n0 z( N$ \
write('</div>')( X: R% z) L* }# i+ g
}
, ~- v: M3 x3 o, n" Pelse if (document.layers){
; P- Y1 v. B  z- fwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')# B3 m* u* H3 Z* T
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
# v. v7 H: X- P! Q: X: }+ Swrite('</ilayer>')
& k0 j+ Y1 @* Y}8 d' P6 K, u5 I) r
document.write('</td></table>')
7 y8 `1 @" |; w0 v, E% {0 {}: [& J* n. L3 r  S' n/ V. w
}
7 r, f+ [8 B; T5 a' |. B* j$ y</script>

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