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

|
网页之跑马灯文字特效
//修改宽度/ [3 T( F$ e; M1 v+ B
var marqueewidth=3008 L- H9 C& _' v' S7 x0 N& r3 ~8 e
//高度. ^, f) w4 U/ J$ f5 q8 ?2 N% G
var marqueeheight=25# U/ A! \% ^& a: l1 m1 a* c% s
//速度(1-10)
/ a+ ~9 R: X0 Svar marqueespeed=3
) U6 V4 E9 S( c) U( E//背景颜色' o ]- Q0 }, c! s+ x
var marqueebgcolor="#FFFFFF"
- `3 W" o# H& w& U# b//是否能暂停 (0=no. 1=yes)?" z! i% N! q& @" a
var pauseit=1
3 x ] M. K0 {) F ]
( Q& g* d7 Q7 [& }0 J# D" Z//修改显示内容$ S4 _4 B: s$ O B
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'9 ^* f0 y3 Z8 X9 M. B) @
* b! p) s3 ^( L
+ |! u" X% l9 n6 V: l B6 O4 v
////下面不需改变////////////2 y7 ^' Y* ]! a: G/ ~% u
) C) ? g2 e# @+ P9 U6 }var copyspeed=marqueespeed1 `7 F/ ]) z- O9 [$ D$ C6 e
var pausespeed=(pauseit==0)? copyspeed: 0
A! \1 c/ ~2 Y& L' U: y7 G& q7 Jvar iedom=document.all||document.getElementById& {" T( j5 k0 O$ g+ S/ s4 ~5 t+ s* N6 ~
if (iedom)
& Z8 f3 [, D; [$ hdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
: f! E9 t* y# Lvar actualwidth=''. K+ {- c1 M6 p2 N9 w" u* ~
var cross_marquee, ns_marquee4 K- K* K1 S6 \# r# G
8 a; @- w1 h# R, u A* |function populate(){( A2 f0 n: ^# ]# p
if (iedom){- v8 K1 `* T5 m2 u
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
o' H+ z, \! i! _8 G% G( L" f. j1 Tcross_marquee.style.left=marqueewidth+8
8 h M3 f, B2 I$ p/ G& across_marquee.innerHTML=marqueecontent# _. o' v' ?' i: W
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth) h: Z! S$ D; E5 j, T c
}
4 l) c& Y$ g/ M D5 e* }else if (document.layers){
5 N' {% f+ `! s& Uns_marquee=document.ns_marquee.document.ns_marquee2
5 g" N/ U+ {. G* `( C& H3 {ns_marquee.left=marqueewidth+8# l5 K; _/ D- N" W6 N
ns_marquee.document.write(marqueecontent); F' ^! \$ \3 V+ j: k
ns_marquee.document.close()
2 \ I' [- d/ U Uactualwidth=ns_marquee.document.width( b2 v ]% g( k4 O5 L* m1 D
}
. A* c' v- v3 y1 o, }lefttime=setInterval("scrollmarquee()",20)
% \1 Y0 f. r" A- |}
; g+ E9 ^+ {/ r( F# i' ~+ Z: p# O7 Xwindow.onload=populate
6 h9 d6 U/ G4 w; _3 S* ^( O4 b" n( a- a1 _/ W# y1 X( h) [
function scrollmarquee(){5 \. l8 {# {$ a3 y2 w4 h3 i4 v P
if (iedom){) f+ q: v; X* z0 p: t+ P- g3 `& l
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
4 Z" }* B6 H( R- s" scross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
& g& F- c( n/ D8 M7 Selse
% h, E5 B2 i* L" ]# L, L$ zcross_marquee.style.left=marqueewidth+8
8 g" b' L) S" N+ e9 s7 F
; S \# R" _9 T& T: U% E}
' i6 O/ r8 C5 {6 I1 felse if (document.layers){& T. J3 N. p6 M4 I1 ~' d
if (ns_marquee.left>(actualwidth*(-1)+8)): D4 h8 y' s {$ S/ Y! y: R) K; h
ns_marquee.left-=copyspeed& S# M2 f, P2 \6 H3 \: r
else
* h# V) n& D/ Ens_marquee.left=marqueewidth+8& V4 \$ X/ r/ @: R# W
}
0 ]8 l& U+ r" R; X}
H+ P& Z" L& o1 U3 h" H" q1 @ w2 f0 K
, l& B6 s0 d/ C qif (iedom||document.layers){) d" d' W% q. R/ w
with (document){
$ ~$ U- A0 @- K4 m1 udocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
7 }. H3 ?0 S0 Z8 x# Sif (iedom){
* b! Q+ K/ y9 }write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'); A: m" |6 A/ o5 r. ~
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
/ a; x" [# n5 zwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')) i; {1 h: k, N% Y! P- S
write('</div>')
+ _" m" o0 Q7 u}
# e. [% C4 V1 ]/ |$ O9 Z& I! S+ uelse if (document.layers){# w/ {6 S6 N4 W+ X' ~$ ]7 M
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')2 U5 t" j) W) T8 o
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
7 o+ N. |' A- Fwrite('</ilayer>')
0 ?9 B: D6 M) B}3 I7 h3 |. }; g' g1 c4 L- w
document.write('</td></table>'): X5 O7 n8 e, o1 v/ K- \! S$ q0 w8 Q* \
}6 s" Q4 ?. ?1 T2 M( `
}( _1 y$ G5 T8 u( b
</script> |
|