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

|
网页之跑马灯文字特效
//修改宽度3 x" a! s/ Z$ V! f
var marqueewidth=300* f' k" e4 I: D1 `
//高度: u% }* ]% ~( z" l' v7 p
var marqueeheight=25
, Y1 [, H; l1 ]" Q1 L//速度(1-10)8 l9 v$ Q: N" D1 N' _0 R
var marqueespeed=3
) |; v- k' o' R' M$ `//背景颜色
5 M' l' }( R* T4 x' C) Kvar marqueebgcolor="#FFFFFF"
2 _# q+ J/ M5 V5 S- j: a3 `; \* }//是否能暂停 (0=no. 1=yes)?! o0 {% f4 V- t) o# W d7 Y! }% O
var pauseit=1
f2 f* i: b8 T1 c0 p" F6 A& Z3 Z, K
//修改显示内容
t2 i! _; @. [3 ~var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
' O ]+ c, K# _9 c3 l2 \; M8 E7 A r7 \' K+ L3 v/ i
- W) Y( z; ~7 o4 {' c6 r% [////下面不需改变////////////
! J) U* r K7 l! b9 d; m- e6 T
8 E! G' s5 H0 T4 e$ c, a5 ovar copyspeed=marqueespeed: @/ b9 h8 l& O( S) y) ~! B4 j
var pausespeed=(pauseit==0)? copyspeed: 0
9 Y+ @# ~+ M5 x. Uvar iedom=document.all||document.getElementById
1 l( x3 [) r+ r1 F Nif (iedom)' A* n" t' J, F b
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')' q1 L" T, {: t# F. j3 f
var actualwidth=''+ t" N% G. T* q/ \1 Y4 x
var cross_marquee, ns_marquee
! j4 J7 V4 ]& R! b$ h$ `
. I0 F- Q5 Y/ J, d* m( q! Q: ffunction populate(){
/ J C, @6 @7 w* G+ [if (iedom){
& S0 P2 X0 t: b: p$ qcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
7 n2 N1 g) N* B& B0 S) Z; ucross_marquee.style.left=marqueewidth+84 A5 h7 @! Z5 j, }& l
cross_marquee.innerHTML=marqueecontent K, q2 A4 \1 e
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
5 q' }6 a, k: U5 e1 L5 \}
X# @4 ]! j7 Y j& _' O6 U3 \: n' _else if (document.layers){6 m% m/ F% x# |: @. W, g& N
ns_marquee=document.ns_marquee.document.ns_marquee22 F& L! j) z: Q6 u
ns_marquee.left=marqueewidth+8
& w. v6 E" |- d7 \1 ans_marquee.document.write(marqueecontent)
R/ J! e9 y; S, d( @ns_marquee.document.close()- T& d# m" F2 Q' t
actualwidth=ns_marquee.document.width
1 I+ ^8 }& A9 l4 K}& m* F+ E- ^ f! s, c
lefttime=setInterval("scrollmarquee()",20)) C0 S! [- ~& W
}
& p0 \+ A1 @5 {0 x+ s% Rwindow.onload=populate5 ]3 l8 L$ d2 k, Z- m. C
$ D- R+ w' }. p& J# h+ ofunction scrollmarquee(){
]3 w, f6 d* C+ v) W. Fif (iedom){: ` K5 n: F6 e, H$ d/ M; S
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
" K% {7 T* a9 u4 y) l g4 R5 C. R$ Xcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
9 C, g) ]: p, h2 H" Felse
7 z. m0 L. P, e1 H9 Xcross_marquee.style.left=marqueewidth+89 b* n5 Y9 t* u9 d
o4 G4 Z3 h$ F% o4 V. P1 `% g}0 G. h6 ]' ^) |) q) R
else if (document.layers){
. }. L* e" a! Z' i5 bif (ns_marquee.left>(actualwidth*(-1)+8))5 D# K9 v* C% B1 j
ns_marquee.left-=copyspeed
. ^( k o I: M* ]* \else
: X( a: k/ k1 t4 R8 s7 {6 hns_marquee.left=marqueewidth+8
B- K/ ~1 N: w; x) C! B}4 R: A% s# k. p( j! ^
}
( l/ V! Q: W6 @6 W3 T9 M& {
0 V A" W; i- p4 T+ Yif (iedom||document.layers){0 D6 S( `- E7 G3 |+ i; v7 R$ ^
with (document){
# I6 o) }2 D. s1 {9 q+ F) fdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')! P7 [" H4 h6 N* j. f0 |
if (iedom){( P2 X9 B# j/ h1 p9 b9 U
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
/ M, B3 ^$ v; S6 ~9 l; Fwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')5 q, S8 r( {5 O( q
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')# |8 w; a5 ?9 t' F
write('</div>')
. Q7 a4 V) ?& |7 ?0 u7 x}: E& h$ T: a' d |7 Y; O
else if (document.layers){6 v" ~% c/ o' F* Y0 @+ \/ ~# e; e* l
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
4 p8 P' x$ j2 q- T6 Jwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
- r3 [' V0 Y3 p1 a; p4 Twrite('</ilayer>')
! z: U; v7 x$ e x8 i4 K}: p$ o1 l2 M; ]+ D! }! p B
document.write('</td></table>')7 k$ g8 f9 S! v
}, n$ }4 s- U+ q( P' \% a2 C
}% p5 W8 t8 }& I( y% e
</script> |
|