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

|
网页之跑马灯文字特效
//修改宽度
8 i) a! Z# f* @; Evar marqueewidth=300
8 D1 @, u. ~( T, }//高度0 p3 ^' u# I% w) b0 n5 X* p
var marqueeheight=25( H6 M& N0 Y# N" d
//速度(1-10)
' g" H' o% G8 ?' Lvar marqueespeed=34 B$ o W. Y! X$ L& E
//背景颜色( S7 x- N4 D+ o5 W9 g
var marqueebgcolor="#FFFFFF"9 H1 T0 c- _. V
//是否能暂停 (0=no. 1=yes)?% s0 d9 B1 n i; |3 w3 f; A" i
var pauseit=1
' y. L; }$ p7 T$ Z4 w
- Y3 F% O# c M! k$ P% [//修改显示内容
) e$ p- c' _. T" J* _3 D. x: Pvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'5 Z3 `5 E: H$ k K& z; u
# G! b& i- \* B7 a
* H! O( e4 m$ c" H////下面不需改变////////////( V6 S: B0 y; o8 \& J4 p
. {# L8 f c1 Z3 D1 F g6 ~3 E2 g
var copyspeed=marqueespeed a1 i, b7 f! ~6 ?' X
var pausespeed=(pauseit==0)? copyspeed: 0 o [0 X' y; ]( K: A" Q' r
var iedom=document.all||document.getElementById
% {" H7 B q n& t: O2 c4 U0 N. Mif (iedom)0 T0 v' o2 }1 i3 W
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')7 \2 b+ o# @7 W8 ^+ `
var actualwidth=''
W4 c) u a) [6 M9 yvar cross_marquee, ns_marquee
7 T: [* Q5 s4 M, S# l+ X1 B! |: n" q/ w% C9 N5 R- ]4 ^
function populate(){; V' d9 w0 a+ e+ E- U
if (iedom){
$ X- }7 o+ c8 E4 T3 M N* y1 ^cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee; K2 \0 U. G9 z9 j9 p
cross_marquee.style.left=marqueewidth+8
w! j; o, @7 Ccross_marquee.innerHTML=marqueecontent
' c4 N( C- I- Aactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
! K ` f4 C. M6 f) V. `}; S3 h! U' {( m( l3 ^* B
else if (document.layers){
1 N0 m; a" W; T5 M6 Y. lns_marquee=document.ns_marquee.document.ns_marquee27 `2 j8 R5 D' }" U, R0 b
ns_marquee.left=marqueewidth+8! L6 m6 a. j- o. [% m7 ?: V% g
ns_marquee.document.write(marqueecontent)2 I; q. Y+ O! b; y3 Q) C- e- o
ns_marquee.document.close()& z' o' s! K4 I8 ~0 L( q9 J
actualwidth=ns_marquee.document.width+ [' w1 y2 s3 H! @4 h% t
}& B$ b! @8 _9 k
lefttime=setInterval("scrollmarquee()",20)
% d, L7 p7 M4 T# {2 ~* h}
9 r0 d/ I. E; n" T7 P9 r% |window.onload=populate3 X* J S6 {, ?- O
, _' {. s7 t- [function scrollmarquee(){4 B* J3 r; D- G
if (iedom){
$ @3 g( u F5 F1 l' V6 f* Z" Mif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))+ y6 ~5 k# r M% A6 h
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed% @+ {2 {, w. U# c0 o* s& ~
else3 G& J; E' A( }0 S6 S2 X- j, N
cross_marquee.style.left=marqueewidth+8
2 e3 X0 y( f/ X8 l1 ]' T2 S% l a7 M. R5 U
}; S" H( u4 x% {) e" g5 U
else if (document.layers){
! _# X& f% `' y7 Q4 ]5 ^) Aif (ns_marquee.left>(actualwidth*(-1)+8))
1 ]. i/ g X. H2 l hns_marquee.left-=copyspeed
, d; ?9 |8 m# g8 helse
0 y0 G7 L# V7 z7 }4 fns_marquee.left=marqueewidth+8
; g7 V; D ^- ^& U}9 o( Z. G! n2 }# d9 z
}7 I9 D% k! `: [- e
/ q$ i* q# m$ T: jif (iedom||document.layers){
$ { ]/ G" I6 J, r3 E. Iwith (document){& b7 J6 M" k# J* P) `1 \- F
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
$ k5 J: u6 p+ I( Oif (iedom){
9 G+ j, B# G- E* w! q8 H( f6 fwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
5 n3 G- T* v1 {- X7 gwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
6 j; W+ U- |) A# @. [* Vwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
! f% w! d, l K3 kwrite('</div>')
6 f6 q [3 m! P0 o2 ^* r, G}
3 P6 Q: ?) b1 L X5 v9 B2 ielse if (document.layers){9 q# d& ?; K7 M% e/ x
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
* N0 [9 G/ S, ^4 T1 M8 K- ywrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')5 L2 M) w) }" B! R& H) W% S% a" B
write('</ilayer>'); ^' f8 r: |5 [. B: c
}
8 S6 |3 d/ m) w4 Z# b& Ddocument.write('</td></table>')
5 U5 }* T& p4 C p- k. J! @- t" L}
z( [4 s/ V+ \2 t3 g9 F* l}
+ Y- D, ` k, |5 S% d8 T. J</script> |
|