|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度
. J5 j- _3 o% E. Y7 d2 T$ j9 Zvar marqueewidth=300
0 z! \% ~2 f( L. d1 P//高度6 l0 c# S" C( ]6 q/ d! x- l
var marqueeheight=25
0 E6 t2 }! A+ `/ }! [3 \' h; q//速度(1-10)/ r) T# @7 y1 V+ L. v
var marqueespeed=3
7 O+ ~$ t' W" i/ o//背景颜色# _( t' m$ k- F |1 K) |! U
var marqueebgcolor="#FFFFFF"- a( \0 z0 n7 t' F
//是否能暂停 (0=no. 1=yes)?
+ }, P/ K8 \( Y- E+ o% V/ svar pauseit=1
4 o5 j/ {+ V. g& w0 n1 D4 X; l4 L9 }2 @
//修改显示内容
4 P L. i0 }, o6 J7 a! I1 U: Pvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
+ u' g2 V3 U: n, a) c/ U
4 [" g% G( w# W" X' Z1 ]0 {
' q' C0 ^' B( ]/ v+ s6 [////下面不需改变////////////7 a4 e! e8 r k8 N5 G
) c U* R8 p5 [$ q% X1 p; Q. F# B
var copyspeed=marqueespeed
3 _2 e- r$ t& M7 R0 `var pausespeed=(pauseit==0)? copyspeed: 0
0 M0 `, L$ c" Y0 y7 H4 r8 }var iedom=document.all||document.getElementById
, v7 Y$ O2 a7 ^5 w1 c3 Z) B' yif (iedom)
9 K9 T0 E9 X+ R! O8 b# Z8 gdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')& Z2 u" Q- l! r, ?5 V- X
var actualwidth=''
! t3 O) H {% p+ G- Svar cross_marquee, ns_marquee, }9 [( r3 J) _; A- ^: F" p
4 ]* p. e- f9 W' p3 I
function populate(){
6 p: X9 n! o& }* \' f& D6 m0 p5 D& cif (iedom){9 Y5 i1 A: {' s+ F& @: J
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
. @/ `# C% W8 x8 n1 V! ]2 @cross_marquee.style.left=marqueewidth+8 e: u- P' _8 J+ ?' I. s9 U$ q
cross_marquee.innerHTML=marqueecontent
# ]" T1 Z u k9 s. B" f; dactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth0 j. a u3 K& x8 r% g/ o( s
}
2 ]! U- B2 u: V7 G! H" |7 d9 telse if (document.layers){9 s9 t% i) ]# Y' x, I' l1 S& W
ns_marquee=document.ns_marquee.document.ns_marquee28 _0 D+ o5 _- @7 z9 a3 r
ns_marquee.left=marqueewidth+8
$ B) i J# z9 G4 Y cns_marquee.document.write(marqueecontent)
: W# p- P% y1 [1 A" p! a. `! Ins_marquee.document.close()3 n% r3 h% t; r' R( T
actualwidth=ns_marquee.document.width
; H: Z. @; U5 y, L}
2 ^ B/ z/ a) n1 blefttime=setInterval("scrollmarquee()",20); s% W2 k S% B& w" v" B' @( j
}, [2 H- g( G" M6 G3 }; l$ A1 \
window.onload=populate
8 x* w+ f# |$ |2 z
* J! d$ i+ q8 r4 Z3 S* o0 \function scrollmarquee(){
' W+ r! y$ i3 Y) i, n" ^8 yif (iedom){3 }( ?( c& X. ~2 x3 V8 D
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))1 D" {! k% `8 R6 H% T
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed4 B# v+ g; ]0 [1 D
else
4 x& `, f) c; n7 g: N0 [0 ccross_marquee.style.left=marqueewidth+8
* j) G# K; r, M" R0 b$ G8 n, \1 Z% {' y+ i
}( y: @6 `' P7 L, g
else if (document.layers){
, B0 N" U( O4 O; Cif (ns_marquee.left>(actualwidth*(-1)+8))6 Y& R) d7 F) g# b
ns_marquee.left-=copyspeed) D! r/ Q8 A5 G, q5 _- t1 B
else/ ~$ E' a8 ^! z4 N5 r6 _
ns_marquee.left=marqueewidth+8) E9 Y# _4 Q: g. i2 F1 u
}
) P) G( g6 |7 ]}7 M9 b2 P& S& T) G9 }3 e3 {
; r/ \3 {- P; zif (iedom||document.layers){, T4 d! ]6 `; }7 F& z
with (document){& a2 m! e) h- G% c
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
7 n: U$ K9 f6 x+ w2 U, |& Z8 Oif (iedom){4 D# e: ?1 q3 `* a1 s8 p3 |
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')7 y% ~- a) o; m9 l+ |; x9 _ Y4 X- C
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
& M: B7 m7 r- [: w" I1 n; Dwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
6 i" l$ A( R7 G9 q3 @, vwrite('</div>')6 Y/ \' c9 _# w% s% Q' {: P
}, Y [/ Y3 @0 L
else if (document.layers){9 d- d/ \+ s% S9 r2 Q, ^
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')! k9 B7 _5 [. Q
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')& T& B6 D* o3 S
write('</ilayer>')( {9 b% ?# w% S9 i
}
0 f* U$ c6 i# z, o: {9 idocument.write('</td></table>')' W* }* H; W' r6 r; }( Z9 J
}
1 r) g3 F' O1 h2 x. f* Z) l}
7 v1 k) Y' H+ e</script> |
|