返回列表 发帖

网页之跑马灯文字特效

//修改宽度' p; x7 D2 H9 t" ]+ E( a+ @' v
var marqueewidth=300
/ _8 [5 z* J; B, \, N  Y//高度
) V. h2 O8 K8 t" \/ n; ^3 j! ^7 Y- lvar marqueeheight=259 ]& w7 U/ S5 ~% V) Z3 ]9 A
//速度(1-10)/ d3 \+ D& H0 W
var marqueespeed=3/ s% O8 w, _5 o
//背景颜色! K9 E4 ^. ^( m
var marqueebgcolor="#FFFFFF", j0 Q9 d  D- |! {9 i9 P7 }
//是否能暂停 (0=no. 1=yes)?4 t% e9 @6 Y6 a; c5 }1 S, d
var pauseit=1
8 [6 M0 ?/ E+ {. l% l; @2 s$ u8 a$ T5 {6 O
//修改显示内容7 s0 C* t, B/ r' d1 I- h
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'  h, [: N: a4 M7 P

* |$ F. ^# J2 b9 q& S9 ?9 m) |7 r/ z' K
////下面不需改变////////////
% Q: B. R& ?0 K9 k0 N/ j/ o1 e5 E% @7 B  b& V. `7 s* R+ A0 g
var copyspeed=marqueespeed9 C- {6 v. d9 K0 G
var pausespeed=(pauseit==0)? copyspeed: 0
* ~/ j+ M. Z" A3 E6 A- r) ivar iedom=document.all||document.getElementById6 l, O4 T) y# w! s" b
if (iedom)
7 r# E  k2 P2 M3 Tdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')9 \5 R. p: l' K& ]8 V3 v
var actualwidth=''$ _' V2 I8 f& R  l- Q
var cross_marquee, ns_marquee
' ?/ H8 y1 q9 q) [  b) }, E+ J8 u" H$ ?9 e
function populate(){
! Q& F; Z6 l) W- {if (iedom){
" o  ?; _5 N8 m2 a9 H/ G' S  Lcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee, J& a0 H. ]$ C% ~# x2 v1 u9 o  O: q
cross_marquee.style.left=marqueewidth+8
: E* ~# }7 v  w3 Scross_marquee.innerHTML=marqueecontent
8 m6 @) h1 S; z! y, f+ Cactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
5 n' p' B) q' L( t5 `) i}
9 h& |  ^) O- E- a0 [else if (document.layers){
4 R, Y$ I- ?" k- |' |7 q) @; Kns_marquee=document.ns_marquee.document.ns_marquee2
, }/ u8 j/ K2 n/ A; p1 Yns_marquee.left=marqueewidth+8
! V, y3 }+ x: ]+ [5 vns_marquee.document.write(marqueecontent)
  J7 q( [" c2 k! x! f* l" ]ns_marquee.document.close(): B" r) h, |( i& F0 o- J/ {- s
actualwidth=ns_marquee.document.width
4 y3 S! C2 Z: @- s2 K- e}* s8 S+ o: f& z5 w6 n, b* Q
lefttime=setInterval("scrollmarquee()",20)
8 @, I7 }) V8 z2 H" F% Q}
- a8 F: G+ @3 q7 h% Swindow.onload=populate
# H" A6 G8 l: |0 a* l4 l) ?8 g9 Y: U( G
# N" Y! y2 _# W' H* Pfunction scrollmarquee(){  M1 @' Y8 D( y! k/ f
if (iedom){
- l# W# T8 _: Y! X  Fif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))3 ?5 p9 o$ u  d5 L
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed  O7 p, F) ^# e2 Y: s5 N
else
' w$ ~. N$ H; h* y9 icross_marquee.style.left=marqueewidth+8
. U5 _4 Q0 L" Y2 W8 m) P& e* y3 \- Y: b, i
}8 A9 @% ]  F$ L7 S" K" C1 {9 K
else if (document.layers){. f1 g/ @. C: B8 R2 S
if (ns_marquee.left>(actualwidth*(-1)+8))
) J0 A( n4 O! K1 ?  U8 l  `ns_marquee.left-=copyspeed
* n( j4 _4 @2 E% R: Pelse  \" C; m: k' Y8 m4 M
ns_marquee.left=marqueewidth+84 C' G" w6 e: \  s' ^) k" ?
}
' P7 A: _  o- A$ p5 V! V9 y}! E. P& v, E  c9 f- m

1 _# z" G& g& y  gif (iedom||document.layers){5 l! Y8 `2 F2 o1 Y9 Y! e! m
with (document){
( }2 W/ C+ O) m/ v& q) Q; ddocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'). Q; S1 y9 O, c7 V5 `& Z0 ~. p
if (iedom){
& s" L) v- ]1 c) T* [/ ywrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
$ A, P$ d$ O- P  o* ?5 I& fwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')+ |3 C* Y3 V* G( d+ v; J
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
. K3 ]3 v4 ^- S7 S% pwrite('</div>')+ d* N9 N  {( B) }/ J. P( {2 v
}
' e  z5 @+ s9 S$ Ielse if (document.layers){* \' X8 O: Z# N4 k3 }. c4 s
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'); V  R$ ?0 \& X% m6 m  M! Y/ R
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'). A" s: {- R; i/ x" k5 X, a
write('</ilayer>')
. Z& p* t8 s  E& _) s3 q}
% q' K; ~; _8 m+ u( R0 Ddocument.write('</td></table>')
: ~# ?  p8 G3 n* _}8 {! A* v) G, l; A% G9 y+ @
}
9 o1 G1 n. K6 u" ~- r; ^6 {</script>

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