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

|
网页之跑马灯文字特效
//修改宽度. \1 z6 _) ~# l" j( V w1 v. O
var marqueewidth=300
# [3 T# ^, a& w0 E6 L+ d) m* L//高度
# ^9 G* {- a: vvar marqueeheight=25) v& x3 N( ?- n+ s7 |, |
//速度(1-10): k7 T8 l5 f0 A; I& x j$ H7 N
var marqueespeed=3/ M+ ~' U) ~; o) V7 l
//背景颜色
: I) g9 _/ a5 u5 z! |8 _var marqueebgcolor="#FFFFFF"/ L6 Y8 @* g" n/ s
//是否能暂停 (0=no. 1=yes)?: v- E) e C+ ?# |5 k$ d
var pauseit=1
; V! V& D) ]" N4 H1 r& }8 R: \& i$ ~6 D9 F4 c3 {; E
//修改显示内容8 N' a6 G, S* `4 e4 F9 f( Y; n
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
3 a7 a" T* l3 y* Q. l2 U, D3 T% X2 \ |! C( F2 T
- a, w( T' u9 l: i8 r# n
////下面不需改变////////////
) I0 o6 e9 a4 x, b9 R6 } j, w3 ~ _% p: L* L
var copyspeed=marqueespeed
% o T9 } S7 c* M/ Avar pausespeed=(pauseit==0)? copyspeed: 0
1 k/ [# O1 H5 r4 r kvar iedom=document.all||document.getElementById0 _" j/ A7 \9 d+ x! y/ Q
if (iedom)
; _# ~- J2 c, c1 ldocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
9 m: ?- X6 B; L, n( t; t Wvar actualwidth=''+ b. e6 g) O7 x2 I, I3 g1 r
var cross_marquee, ns_marquee) Q9 v+ `; h) N4 H( h3 U
8 E7 q' U' \& {8 Kfunction populate(){
$ v( R) z; v U2 b4 b* Y* bif (iedom){) ~# Y9 b' i, z; R, K
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee0 H: q. Z# Q- v* t
cross_marquee.style.left=marqueewidth+8& C% O) x/ g( C% Q+ I9 F" R
cross_marquee.innerHTML=marqueecontent8 k* [/ Q4 Z- B- P% z
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
6 L+ F) ?4 c, v}* |; A3 _2 m1 s* s
else if (document.layers){
& V$ U1 H8 ~' V, _% k* y: Tns_marquee=document.ns_marquee.document.ns_marquee2
: H, ]2 w7 m( j5 x$ h( M6 m6 V, J/ Ens_marquee.left=marqueewidth+8/ m+ \; I5 t8 G; W
ns_marquee.document.write(marqueecontent), B: F* R& f7 H8 b- Z
ns_marquee.document.close()# o+ {# @+ y G4 L$ L
actualwidth=ns_marquee.document.width+ J% n% ^6 q$ A% q+ B" }0 P5 u
}3 c. ]6 a% ~& [
lefttime=setInterval("scrollmarquee()",20)
* ^- R# S3 @- Z9 \; S0 n, j$ r8 `}& ^" V2 `1 W( O
window.onload=populate
. Z; P/ }0 H! n' W8 U% G$ k6 D" E. f8 B Y" U0 x
function scrollmarquee(){
) d" K' j/ \& Y1 V+ O$ h8 @if (iedom){
7 c2 `0 L8 j% i2 B/ b$ a/ Nif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
2 F1 J4 p8 ^0 ^8 N$ pcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
0 o+ J+ a9 G0 S) i- uelse0 ?+ L2 }+ X% E! y
cross_marquee.style.left=marqueewidth+82 X) x3 ? H5 e; S/ j R: Z* Z1 X
6 L' d: g6 `' l c
}5 ?2 N) e8 z# N. n" |
else if (document.layers){( o) C* |, V5 u8 Z, Z, }2 K% C1 s
if (ns_marquee.left>(actualwidth*(-1)+8))
3 P6 c" [0 b4 K5 x1 G3 _! |, }ns_marquee.left-=copyspeed) `9 G6 R1 L! h3 e9 \
else
" q0 g4 K; j9 \, k' X- Bns_marquee.left=marqueewidth+8 e7 h- _* e: p8 r* M% h. Y
}
/ P8 z2 g( B$ y( d}
% B& D$ f% R; e2 z: ]' ]- y7 K {) F: F" m/ M
if (iedom||document.layers){% y+ m4 V- f9 ^3 A6 S
with (document){
- T/ O- z9 i6 ~( c9 L; xdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
7 s3 l# h t0 j, Oif (iedom){
$ N+ {8 U7 s. Y/ A( {write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
l4 `# E% \" ?% X! U+ `3 z6 A- swrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
5 [/ {+ M# M$ H9 c+ ^' }9 r, Awrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')/ r* L9 [& |6 M ]/ k3 V: G
write('</div>')
7 J; o) z& O( d A6 J/ l* a- T# `}9 ?4 c" U5 j6 p( _
else if (document.layers){$ |( t0 T1 b: J3 F
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
$ R4 D" _4 E u* cwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
: @8 {, U! ^9 Z0 v" fwrite('</ilayer>')
$ V4 W; h& S& j) r: X9 N}- R. @( i; }- |, v6 Y" L
document.write('</td></table>')
( J8 Z( H& s1 ?4 O( S' [: D" X}3 i. m4 {3 s% g) g3 N
}" S9 V% I4 l& f
</script> |
|