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

|
网页之跑马灯文字特效
//修改宽度8 s. ~0 G- D& A) B
var marqueewidth=300/ s4 M( n `9 @- w9 G
//高度% D; {8 @0 L. t h! Z) [
var marqueeheight=25
/ K( r9 {: z& B5 \% r//速度(1-10)
* L, R' u; L3 Y9 svar marqueespeed=3) P; ?, v# ~; g' m" l; G
//背景颜色- x: v, S H7 y! ^* M/ y# j( E
var marqueebgcolor="#FFFFFF"1 h+ E; {7 j" o9 L: h1 ^" e) E
//是否能暂停 (0=no. 1=yes)?
8 s; D( l4 o- r8 q$ Gvar pauseit=1
% ^6 X5 w3 k" V7 j9 _. Z: a8 i7 M3 q# U6 _, r
//修改显示内容7 F# p1 p Y! S; J0 c% t/ `! k
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'2 H/ r8 N: B3 F7 F
( r# r- L3 X' j, N2 E. k5 x
( A" }7 v. Y' F3 I
////下面不需改变////////////7 J4 N7 V1 h ~* Q( y- H$ R' Z
- n# D7 [" n. F" e( ^
var copyspeed=marqueespeed
3 Z1 ?& t/ q( a Q, r- Jvar pausespeed=(pauseit==0)? copyspeed: 0" ]1 e- ?: Y" J
var iedom=document.all||document.getElementById1 e5 T. s& n+ H1 j
if (iedom)
% H# w. K4 d( K3 y: K# P7 ~& J8 fdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
$ p) B) Y# ~; G. pvar actualwidth=''
0 d0 m+ Z5 g& I6 }var cross_marquee, ns_marquee. N+ @& p6 W5 t) T( ?3 Z8 o1 z
) e, Z k' K2 M( U
function populate(){, X/ t3 r9 a0 { j+ m
if (iedom){# {/ N1 W: \% M7 b! Y1 @$ [( x% D2 L0 a8 m
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
7 {, N- j+ H# X/ h- Wcross_marquee.style.left=marqueewidth+8. v* d% r1 y$ q7 y
cross_marquee.innerHTML=marqueecontent; B5 S" [9 }; }9 @
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth T$ m+ O! E/ j
}+ l s. y0 O" p* k" Q& i# c
else if (document.layers){
8 B+ v4 \7 D2 w5 w+ x3 Nns_marquee=document.ns_marquee.document.ns_marquee2
# u: f C \ M- }$ F5 x/ Z8 w* \( xns_marquee.left=marqueewidth+8
/ ]# p) c; ~2 Sns_marquee.document.write(marqueecontent)8 v; i, o4 y; `5 R: { `8 P
ns_marquee.document.close()
5 t+ q: S+ T. Q) O. y0 Q! Y. Dactualwidth=ns_marquee.document.width
( z/ d2 _3 `8 x}2 P. Z9 H; }9 s4 x* \( w
lefttime=setInterval("scrollmarquee()",20)
. _* L+ O) T1 F* f& g/ \}& H2 H5 _6 `; X; `
window.onload=populate" ?* A- m7 p2 V. z7 l% g3 M
$ v I5 l0 m/ ~
function scrollmarquee(){$ V9 r/ T! l/ h5 @ P+ c
if (iedom){- Y6 M2 J% V: m) W
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
( `) }5 d' @9 g L; ]cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed B' T" w3 ^8 F" ^5 i8 N
else3 i# @ i6 J+ {
cross_marquee.style.left=marqueewidth+85 z& E& L3 f5 m5 d6 l
2 a) I5 C& Y( s" ^, u}
* R, ?( B/ y' G) e- m# K1 ]else if (document.layers){; b# C) [1 h" ?' Y9 _3 k
if (ns_marquee.left>(actualwidth*(-1)+8))
. \. C6 a- n8 b2 Y% H3 Lns_marquee.left-=copyspeed. T! ?8 m, n8 M) u/ _9 J, b
else
l U4 r8 t0 c4 Q1 t7 Y$ T( Kns_marquee.left=marqueewidth+8
7 s) Q7 ~* C8 B$ n}
( i5 }; l5 Y/ ] E4 A/ b}% j) {, g! }. q Z3 l+ Y
8 N) B+ O0 C8 `% I2 K
if (iedom||document.layers){
' Y0 V0 ]# }! R/ E& ]+ c2 |with (document){( S8 \& i, ^0 }. o3 d9 V7 \& S
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
6 B: v1 v4 E, V7 Y9 Bif (iedom){
- E1 d( I1 o+ D/ e" {# Swrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')8 B4 a/ K& P: z
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')/ R# f( ~* n+ T
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')' E1 f" {- s; ?1 H/ g' C. M
write('</div>')* M; i- P: A; r @
}
' o+ D: W3 f* n, d: l4 {9 r7 lelse if (document.layers){
/ P+ |( m; H9 e* b: iwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')7 @4 h. x$ l- s
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')' `* Q/ U" ?( j& e+ a; W, f
write('</ilayer>')
" z; e1 ?- K! M& G/ @ Y8 A" o}
$ v0 Z: V. P! b0 h2 z" }' Zdocument.write('</td></table>')
! F, e; s& g* w# {* H+ e5 ]# q8 a& T}6 I0 ~9 ]7 g7 p
}
9 n. R( Z& g' `* }# L</script> |
|