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

|
网页之跑马灯文字特效
//修改宽度
f0 W& G- W' z: H3 R; ` Avar marqueewidth=300
/ x7 B) B- N- Q, ~& k; ^4 V//高度
5 S0 X+ @0 Q5 K$ S ?$ xvar marqueeheight=25 n, Q: J% A% k, _1 Y' K; }
//速度(1-10)1 B3 M# Z& D+ a# T
var marqueespeed=3. P( B: ^6 R& T/ E) l$ F/ _- r
//背景颜色
8 Y3 `' C# K7 p9 I& t \var marqueebgcolor="#FFFFFF"
) M2 _; M5 m5 E; G1 {//是否能暂停 (0=no. 1=yes)?; ?9 K1 J: I# O& X8 ?( e9 z, }2 t% p
var pauseit=1
. I/ D9 r* E* e
4 l7 @$ H, {# F/ r( v- V//修改显示内容
E" Y( I/ k$ N$ Qvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
/ P! A N2 a3 c
& U& f- }* `9 _9 u% c* S8 _% p. z1 j" n4 M- I: y
////下面不需改变////////////
$ n# p1 g6 U" k+ v+ ]; w! C* O
9 l0 M3 P% D" m/ U" ovar copyspeed=marqueespeed
( D) t( |! U' _4 r9 S2 Avar pausespeed=(pauseit==0)? copyspeed: 0
, ^* q: Z, V5 h: \' jvar iedom=document.all||document.getElementById+ {0 Y" h1 V5 e2 Q
if (iedom)
/ i ^ p, `& u' jdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
% S% y, H: `% L8 t2 C: D/ n5 p' K5 svar actualwidth=''
- x A. k5 _1 l" o# K4 r8 Fvar cross_marquee, ns_marquee( |& k7 `" D7 T( h8 T8 V
7 g4 U- t2 Q2 R7 M) f4 q8 X- bfunction populate(){
6 }3 P0 ]0 s! q1 eif (iedom){
+ m$ s1 @! ~5 D: L3 P- Across_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
/ Q2 J3 w1 a* Ecross_marquee.style.left=marqueewidth+8
* H$ x" ?5 z% `: a- Y, e) E( a% Bcross_marquee.innerHTML=marqueecontent
. ?! D" x' J" o0 {7 Iactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth) m! E7 V/ P k4 E1 U. s' g8 ]
}6 S5 {. t& \9 S5 @' K
else if (document.layers){- L, ?% ]2 L, [% @
ns_marquee=document.ns_marquee.document.ns_marquee2
0 t1 H9 c& d1 z% a% j5 cns_marquee.left=marqueewidth+8
, b3 d5 T- r# @/ u1 _) Ans_marquee.document.write(marqueecontent)
$ k9 d4 y: S2 h% ], J+ m8 ?0 Pns_marquee.document.close()& m' `- f4 a1 N) H$ y) `8 ^
actualwidth=ns_marquee.document.width
4 u, |4 h& N! ^' K7 n}
& K! S- L' F z% P2 J1 g4 P- Alefttime=setInterval("scrollmarquee()",20)
$ ~3 K3 g5 A1 k4 W- o: U5 S}
0 z! P1 ?6 U3 b" [$ G; swindow.onload=populate
: e8 G" H- c9 T" G, X' j1 o
" T2 p. T' J; I# a- `+ ffunction scrollmarquee(){
& ^5 w' ^8 T- hif (iedom){& J7 w( ~& ^& V
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
2 C& \; ]: f8 Fcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
, M/ v) ~( G+ v0 \else
% ?4 I! `6 n- A$ |cross_marquee.style.left=marqueewidth+8
3 G- h. o z! B' S9 ]+ Q# f2 r; p3 d/ F# Q! a$ R3 N4 T- y5 h- h# d
}! {! M! U- E6 h" V, S
else if (document.layers){
% d. b. z) j0 ^) Qif (ns_marquee.left>(actualwidth*(-1)+8))
( ^ `0 o; V2 u7 Mns_marquee.left-=copyspeed8 [9 k# k2 P# _' g: o0 O0 B
else
; G# V! J) f. S4 _% L( S* Ans_marquee.left=marqueewidth+8# h- A/ h1 w# @: g1 c, y$ k; s
}
: V: d9 k Y. E6 c& |) q- H4 W}
v( e9 v5 k( W
2 P3 M2 e" F9 q% D/ X. Lif (iedom||document.layers){
3 c ]+ S8 @8 W2 qwith (document){" i8 E- T' J7 y d0 W; u |
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
7 u2 N; P' Z5 ~( Jif (iedom){, p8 p8 ^+ U3 y2 j( t6 w0 }) \. V3 }
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')$ ^% I e8 Y, d+ j/ e
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
7 d' r. J, G8 P& e0 A. D7 K) Q6 G7 Nwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')' j; _. `( v' c% j* I# B7 q; o
write('</div>')7 m/ L, z# V# S; t
}1 ^# q& F5 G) v( l
else if (document.layers){
5 D, ?; D- x* C @7 Pwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')6 |$ }5 W0 Q+ B! E4 l- ~
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')" [" P9 ^/ [( f/ Q4 ?) @, p
write('</ilayer>')+ U. Y- g0 ?- U, g8 U* [
}
% s( D, |2 l; x6 ]; D$ gdocument.write('</td></table>') r( U8 \0 N2 I& e+ a: ~, n# v0 Q
}
: }7 g: Q+ c9 v0 I$ j) r}
% G8 w& k! f* e' c3 s& `4 ]! ?</script> |
|