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

|
网页之跑马灯文字特效
//修改宽度6 w/ x, _5 O# j3 o& D0 q/ o/ g
var marqueewidth=300
# [2 [! c+ l, M/ U//高度
8 N6 j; } \: I0 _" s9 m. Vvar marqueeheight=25
. T' C+ z# K6 N" t2 S' X* S! ?9 m//速度(1-10)1 S/ m5 C# W, K! m5 v, u# Y$ ~5 T
var marqueespeed=30 Y6 u/ y8 I3 y) P$ t$ |7 v
//背景颜色
( s" S+ E8 [' W2 q; l7 _5 Ivar marqueebgcolor="#FFFFFF"
9 ^: R) G: L3 E2 w) H6 U//是否能暂停 (0=no. 1=yes)?
+ v9 i0 ?$ B( xvar pauseit=1
1 a7 I: C5 ?' c" `! e, k7 P
; b& s& i: ?/ J) T2 e: D' q$ t//修改显示内容
6 A8 }0 Y" v: Yvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'% _; O- v5 Y. Q* i# U+ @
; k# r' S2 X$ Z$ l1 v }0 ?7 o
4 V7 |+ G5 l1 l3 ^
////下面不需改变////////////4 s" h, L0 E/ H* ~
7 g. k0 Y( g# A3 lvar copyspeed=marqueespeed3 `9 M1 X2 @" R2 q1 V b
var pausespeed=(pauseit==0)? copyspeed: 0' I) x6 k* k) p
var iedom=document.all||document.getElementById9 k: [& Y8 L; a# G3 A
if (iedom)% o* t" ]3 B! _4 ~6 q" Q
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')! f# W6 r2 \3 i7 d& _
var actualwidth=''
7 k j1 k& y( R; |. Pvar cross_marquee, ns_marquee
7 C) f+ _" u4 `: F2 i& e6 |, P* o" r
3 V; ?/ U3 g% N0 j3 Y* ^9 ?function populate(){4 P9 u7 i& w& A
if (iedom){: |1 X" E7 ^' l0 x: r
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee# }4 I* s# O& K# q2 T
cross_marquee.style.left=marqueewidth+8. X/ D( L$ V' j+ O4 x7 k. ]0 i
cross_marquee.innerHTML=marqueecontent, { M& D: B. q4 s
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth, e. W, X2 Z/ w" r" c: i6 e8 F- c
}2 {: v* i9 q4 N) f. Q! D
else if (document.layers){
( d O0 O, \3 k3 H" [ns_marquee=document.ns_marquee.document.ns_marquee2 A& R+ W+ N' D1 w: g, S
ns_marquee.left=marqueewidth+8
% o, E" y5 ]; D+ W, [( M4 }ns_marquee.document.write(marqueecontent)+ `3 E& C, M: r8 b
ns_marquee.document.close()2 g: ~) h2 e# _, Q& m2 @' G
actualwidth=ns_marquee.document.width4 }) f. f1 E4 e9 O1 m f* W* j
}
2 U9 p, U% x4 @lefttime=setInterval("scrollmarquee()",20)
+ x& E* H. _& l3 |. j! k3 i8 }! U! K}7 ?9 g! e% {5 C! R
window.onload=populate6 j9 c2 W6 Z) t# \( b- a0 u1 y
& k# A0 g* P5 H% V' C$ _# [
function scrollmarquee(){
- H7 t) S( g9 m& W% Rif (iedom){
* n2 v8 K( A6 {3 D2 zif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
0 P4 d9 j, w: across_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
' X7 Q6 T! v2 Nelse
4 K5 v! I6 I5 S' R; E6 ?% U( \cross_marquee.style.left=marqueewidth+8
; S# i5 S, Y' n
7 ?$ f4 p1 m8 r, x5 c" R4 ^}- K0 b" o* O+ R
else if (document.layers){7 I+ n4 V8 R' E1 C' m
if (ns_marquee.left>(actualwidth*(-1)+8))1 G3 [) l) p4 U& D1 o% i
ns_marquee.left-=copyspeed
* I# n1 {& e. O! _0 ?else
+ v! P5 X1 W( d4 v& e6 }1 {ns_marquee.left=marqueewidth+8
" b, W3 T5 N- F& k2 _) {; i}
* Q0 p, K* d' j0 u* @- e. g o}
, `8 ]( _8 Y2 S5 }- \# D) `
, x }8 i" j! y$ n6 C6 \' J- ~if (iedom||document.layers){
( G7 ~4 k9 A/ R$ x# u! [( N% `" fwith (document){
( ?$ E4 H; d. Q! Hdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
. t* Q$ f, c; q' R( bif (iedom){
/ Z- X9 P7 H$ ]8 f; uwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
" j$ W/ k- l% }4 F$ ]. P+ I; m. cwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')1 C; Y6 U d, B
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')6 [, Q8 n, R: ? c. x
write('</div>')$ y' Z* m& H) }: M
}+ }+ o! T8 q/ {3 G
else if (document.layers){
$ e @; _) e& Y* zwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
: q+ z; s0 J: y/ u) r1 ~" Owrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
. Q. V9 ^5 n/ c) e$ Xwrite('</ilayer>')
. `% X3 c% { ?4 [; a}
# x4 R' b- q5 mdocument.write('</td></table>')
% i5 ]3 |5 F9 a, Q& L6 R( G" u5 E}
6 @; j. j0 R0 M( ]}5 h" a0 i1 ]4 t0 v1 F9 O5 Y8 _; Q0 b
</script> |
|