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

|
网页之跑马灯文字特效
//修改宽度
6 g6 ~5 o) h. Q/ U/ u: Nvar marqueewidth=3003 j- q& z7 X+ Y1 {& i3 O$ G
//高度) P- X5 }! A$ T: J& w6 i9 P0 p, E
var marqueeheight=25+ j% ?$ o6 P+ ? ^* \( e
//速度(1-10)+ j9 B2 Y, N" t
var marqueespeed=32 N6 `/ f9 S h5 ~+ R4 Y
//背景颜色& O1 Y/ |9 S+ u8 @% j/ x
var marqueebgcolor="#FFFFFF"$ c1 H- S0 K8 M
//是否能暂停 (0=no. 1=yes)?
. S T1 v8 l; {9 e# [8 @: hvar pauseit=1" T6 K& U# v8 p4 R R/ Q+ X
! t0 ~; |" T# [& h
//修改显示内容, j) i' M* f9 K
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'4 q- ~. G- w# D2 b R n; a ^
0 W, i- P a; w" ?1 e- i% w
. P! J) [. F" ~5 e0 Y/ R. |7 m////下面不需改变////////////1 p% X# _) N( |: G
" C' m \ n2 \2 |$ Y1 F5 Lvar copyspeed=marqueespeed
6 j5 D+ I. R- d' Z7 H" {var pausespeed=(pauseit==0)? copyspeed: 0
% v0 T. _' J1 z8 t" s9 }# f. y2 }var iedom=document.all||document.getElementById
, f8 D0 e' a* n: w( j9 F: Gif (iedom)
8 U* k* t4 T. j8 fdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
; V9 p9 \6 ^" f6 ?var actualwidth=''
% j- x' o' B0 w% Dvar cross_marquee, ns_marquee# v3 Y3 H" c4 m1 X" K' i. b( K
. Q$ V' E' u7 h! i6 R' Mfunction populate(){
/ e) Z& V# M0 ~ ?9 d% }% ~& Cif (iedom){" z% P y; x/ ?
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
1 ~5 K, t# e2 n% B% P* c3 ccross_marquee.style.left=marqueewidth+88 j _9 x+ a: L0 {2 q! e+ E
cross_marquee.innerHTML=marqueecontent# C7 [/ m! z4 @
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth6 c2 T% `, f# r3 O6 d
}
7 R4 Q+ j* a: m4 zelse if (document.layers){
?* s* V9 j$ P' f! C0 r& sns_marquee=document.ns_marquee.document.ns_marquee20 l3 F3 q8 W* o/ H9 S
ns_marquee.left=marqueewidth+8
) {; W' I7 |0 R% O& K$ O% tns_marquee.document.write(marqueecontent)
5 Q+ s3 {/ a; |ns_marquee.document.close()! t. A; M% D5 [( l
actualwidth=ns_marquee.document.width
- u! H8 o5 E: \4 M}; N# {) n, S, G
lefttime=setInterval("scrollmarquee()",20)
# F1 ?3 u5 F! s$ I}
( K5 [0 O8 I, W8 p3 P) ]window.onload=populate: ~ @/ Q. g! S
3 G" `: r: P' v0 Bfunction scrollmarquee(){
+ |3 T O: E8 u; h% n/ i' Sif (iedom){
! ^9 d6 W/ x( _if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))( ~0 z2 P7 S4 c$ B4 K2 l- O# R+ G
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
9 O3 o$ N$ L7 Q. S5 y' Eelse
9 f/ ~# ^$ o& X, t0 v+ M3 ycross_marquee.style.left=marqueewidth+8
. b7 A! G; M, j, ^3 U4 E+ J8 Q& [) W. m7 E
}% Z* K0 J9 i4 q+ B D5 T, c q/ K
else if (document.layers){
! X) }* \2 W+ Sif (ns_marquee.left>(actualwidth*(-1)+8))
- K! Z. Q3 A& K; p8 Y# \ns_marquee.left-=copyspeed" I4 [+ I2 j2 r2 @* @0 |1 t
else
, l7 N g) _' h$ H' Wns_marquee.left=marqueewidth+8
6 |% m, F! q7 h' _% J}! `% T1 c0 P- b
}
& t8 f: X! f' x6 p+ P8 n% d& M1 H& @ d. G# }8 e# F, S5 r4 L
if (iedom||document.layers){( ~) A8 n& V" t) b
with (document){
4 u( b0 Q. ^( e4 T I- Qdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
' B. W1 X! u$ d% Uif (iedom){
: Y9 M9 D2 _% K% cwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
0 i! L o' p3 U- Hwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'); C8 H4 V8 I; L- r# m
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
; ?; D% T7 n: g1 j+ t x+ Z$ V! ]write('</div>')
9 H2 x0 C( [7 [, L4 b}
% H' ^) P5 Q# v& Z$ s6 yelse if (document.layers){
& d* r2 I- M' ?, T! o4 k' N8 ]write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')% l; p8 O4 C/ z( e
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')- [9 J2 m* b; N0 I
write('</ilayer>')
5 j- j% P' P& B}3 [7 N' T7 Z" F6 l
document.write('</td></table>')# e4 E$ z, ?. w% i1 b/ K" e* ]4 u
}
: O8 k* c9 M) X' h: N}
7 L( P, | A2 a. ?; b</script> |
|