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

|
网页之跑马灯文字特效
//修改宽度
0 j0 w( N" ^& _var marqueewidth=3005 Z0 x% ~( ? ?
//高度& B1 T1 S. g' r( L
var marqueeheight=25
0 @: O/ b n) G* {//速度(1-10) a3 K, d: _2 j
var marqueespeed=3
( T1 z* d }$ f3 F) [3 {, o//背景颜色. a& F) a {- B" c: {
var marqueebgcolor="#FFFFFF"
+ m9 n/ O/ D y+ _- C: h//是否能暂停 (0=no. 1=yes)?6 C& ^+ H3 i7 s: f
var pauseit=1
$ h& f* Q g( C) J$ J* j; C' c; \/ J
//修改显示内容
/ [. J+ N7 c% svar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'6 t% e! O' K; ?6 n6 {2 J9 t
# m. R) p5 R0 p- ?, j: x) B. G3 Q3 h8 K T8 [! N
////下面不需改变////////////. |0 W5 @" m0 E2 }
; b$ a4 x4 X" ^# F0 T" P. {
var copyspeed=marqueespeed' y7 t" Z; K, s0 K, R) n9 g
var pausespeed=(pauseit==0)? copyspeed: 0" ~5 X' q& @+ g Y
var iedom=document.all||document.getElementById5 o7 H9 ]0 H" g6 i. n
if (iedom)) @" X6 Q; h& b. C
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')7 O- O7 H: h% K# a" Q( Q8 I
var actualwidth=''
2 M9 X8 m4 Z+ ^2 @- _8 E; h" ivar cross_marquee, ns_marquee
' g: r, r- r8 [& `( A+ |
4 H; x1 M( n' k% o/ Nfunction populate(){
+ m4 J# G/ @1 N; { oif (iedom){6 R; Y' Z1 A/ `4 k2 V
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee! Q- F9 x. N$ T* H
cross_marquee.style.left=marqueewidth+8
; L9 o N8 F+ E x$ e( l Ecross_marquee.innerHTML=marqueecontent
. N$ O1 Z; x( `3 ~actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
3 m6 J7 w0 J s7 x* w# N}8 [. F; X" C% r9 b% U8 m0 G; `. [
else if (document.layers){! R+ u2 `0 D( g* h; U6 X
ns_marquee=document.ns_marquee.document.ns_marquee2
1 }. g! j! w' w l. |' u- uns_marquee.left=marqueewidth+8: g, r8 y* f* D, g9 F
ns_marquee.document.write(marqueecontent)
# l. g4 A5 p1 A% v: v( `+ nns_marquee.document.close()& U/ {- O# ?+ i' d
actualwidth=ns_marquee.document.width: N, t9 R8 V4 H, o; S4 ]$ ]
}0 h/ E* p7 R# i& i, B& T9 ?8 F
lefttime=setInterval("scrollmarquee()",20); F5 ^+ x/ Y- b3 d( }! R
}% L) L% ]& b& R# ~4 a* ^/ B. T
window.onload=populate" k2 m0 \8 v* K# i0 h- ~
5 a/ L W1 ^8 @* P! ^% Sfunction scrollmarquee(){+ \3 g& Y/ j! r: z2 p" Q6 Z. T$ n
if (iedom){& r# u0 S# j( ~8 C( I' c
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
+ w& S0 T- S6 `' ^) Xcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
. ]- [' o! h- xelse9 ^$ [7 o/ m' V% \. R; l1 F8 d
cross_marquee.style.left=marqueewidth+8
4 G) u4 Y; e: h1 x6 v- i! {7 K# V3 N4 f# g9 @% F& Y
}
2 p) z& w4 B( E# f, @9 ?1 ?+ Q& o0 velse if (document.layers){
5 u p' B. U# m8 D! Mif (ns_marquee.left>(actualwidth*(-1)+8))& G3 Q$ v* l& e; g: q1 F _2 X
ns_marquee.left-=copyspeed
# |+ n3 m8 H' r# M, C h" [else2 ], m' z* \5 g1 {
ns_marquee.left=marqueewidth+8
[3 U/ }9 u3 m r* |0 @. S+ D}
- R8 t9 d) n+ r5 Q; y Y5 _}
$ D# {7 F! k# ?2 I6 }& d3 d% f
4 K3 n5 H6 [7 L8 I& d* L, T6 `. ^if (iedom||document.layers){2 z+ K8 H" a+ t$ E5 f
with (document){% N) `: i$ z6 {8 [/ W8 T1 [4 D
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')# F5 O( P8 Y) U( k1 J! H
if (iedom){
2 I- k- D) v/ R/ K: p1 H' Nwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
* N% `' k+ t& b; x/ R# |' V$ ~% Dwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
3 m7 s m F4 y; C; B$ ^write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')6 j* U/ e9 j! J# v7 }" Z3 P
write('</div>')9 t7 z3 `9 P' c7 ~& R- \$ a
}
9 B8 C" O/ W# k3 x; Y, E/ F7 Uelse if (document.layers){
& M7 t- A- v; w+ x' swrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
! N! t' V5 r5 k' S4 X5 [" B3 ~write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>') P2 R$ @5 h A; R: j( G
write('</ilayer>')
5 m0 b4 U6 L2 W6 G8 N5 l}
1 }; }0 M! E3 q9 b5 mdocument.write('</td></table>')
4 }& D) f+ T/ ~. ?}3 _7 c0 B2 r" h5 Y
}$ p" p0 R: ~" _( @8 b
</script> |
|