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

|
网页之跑马灯文字特效
//修改宽度
! h6 B% V/ Z5 s7 w: T- l4 w3 [var marqueewidth=3000 n1 x S# F, l
//高度' h; J# P3 I. l/ v
var marqueeheight=251 a. W$ l! j5 {2 Y; B
//速度(1-10)
5 a3 t" D3 G4 D- A: M- |var marqueespeed=3. a# m8 b; I; p2 Q$ A
//背景颜色
5 q+ A6 q" l2 u9 B4 H4 z8 ]var marqueebgcolor="#FFFFFF"
9 D1 }6 h- p/ R( K5 N& s//是否能暂停 (0=no. 1=yes)?5 p$ Y% l' G0 ~
var pauseit=10 y: v# F7 r+ K& k2 J% C) k
7 } \) F: Y* U! t
//修改显示内容
2 @& s% \: k( f4 L2 D/ {* Ovar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
/ @$ c' Z# K- Q) f6 V! z4 z) L6 z0 q
- w, m5 p |$ L! S! G+ `
////下面不需改变////////////
{' m' J. ?- f8 a4 l, ~% e) I0 G6 K9 I* U. z' u5 e
var copyspeed=marqueespeed9 F- }5 H& Q% @0 X
var pausespeed=(pauseit==0)? copyspeed: 0, e3 c# T5 [4 ^" {
var iedom=document.all||document.getElementById
, ^) W$ S6 v9 b3 g. y. H o4 mif (iedom), A4 I6 n: X, R- E( h7 ~) j) L
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')7 T# ]2 s% R& b7 ~' s
var actualwidth=''
, T+ F* V% z/ `: w) h$ A. mvar cross_marquee, ns_marquee5 E% z3 v0 Z) I7 l! J1 z
- O% {) I* c. b2 A4 w7 F& Gfunction populate(){
6 J: z! v: I0 }9 U7 Mif (iedom){
" _- [% t. j2 o5 Y) C( T/ across_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee) {8 `4 K6 _1 c8 g
cross_marquee.style.left=marqueewidth+8
- P6 O4 ~$ c/ ~3 X4 O ocross_marquee.innerHTML=marqueecontent7 v8 h: E" d8 Y4 T- v+ x2 h
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
2 K/ |* E$ \# ^" |; R" P}
- }( l3 S7 [0 F" I0 L, u J( S% c+ Melse if (document.layers){
( F# a8 A& ^( Y* R2 uns_marquee=document.ns_marquee.document.ns_marquee29 b1 ] w4 U3 X7 M: u% r7 `
ns_marquee.left=marqueewidth+8
+ g/ p# V$ j# {# ~ns_marquee.document.write(marqueecontent)5 X) d9 I; {" Q# A% P
ns_marquee.document.close()$ a Q. i; Q8 Q) H- R
actualwidth=ns_marquee.document.width& n: U c! z+ w% G% _, @! k$ P ~
}+ o& F) ]7 w1 l+ [6 D
lefttime=setInterval("scrollmarquee()",20)
( V- L z. n) G! ~+ w+ q$ c}
6 ?/ r8 C/ G' t" h, {window.onload=populate
1 e( o$ b0 y+ S3 z5 @+ S
1 y9 A5 J, d; X0 h1 Cfunction scrollmarquee(){6 s6 P6 I% c7 q/ E ^& B+ s; b
if (iedom){
1 N# q+ C9 b; }if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))0 _- @$ f, o, i* S
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed" B$ y$ n: M, I
else
, ]# a5 R$ [, D5 fcross_marquee.style.left=marqueewidth+8
( n3 M. u1 n% E3 p% [! Q Y! D
( w2 {7 D: ?0 k; j}
9 f$ p9 `' P2 F% _$ b" v% }else if (document.layers){
/ o+ M" _3 U* ~0 J3 w+ vif (ns_marquee.left>(actualwidth*(-1)+8)): r6 P! {5 \, c2 l
ns_marquee.left-=copyspeed3 s1 v3 s. }" U
else3 w8 |8 L% X, z& o8 [( e
ns_marquee.left=marqueewidth+8
7 O# `$ o, S9 P/ E# D. u( d; V8 z}
) r1 P0 G2 o- Z r# D}) g; k0 t0 C& W+ d/ P4 L
! K+ }/ n, W; d9 [
if (iedom||document.layers){2 _6 B$ ]: h' W& W( v) U
with (document){6 C4 Y/ j, p% ?* K7 E- w# z
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')0 C' b" }1 R; w% N$ t& W3 }1 o
if (iedom){: y7 p* t: v3 U
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')! \1 o5 H/ M* H6 Z
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">') A- C( [" X+ U
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'). ]2 j- m! p3 T7 B" Z! T
write('</div>'), F I. A b8 r; n4 |/ j
}
3 ^. n# c! U; x' e! q* \/ ]else if (document.layers){
% i9 S q( k- f) h# s+ i; U7 |write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')# F5 G" ]# q4 ]4 S
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'): l7 q6 }1 \$ H o
write('</ilayer>')
. k' U% v. V: B( _, G7 m# f}1 r) T0 m# h2 j# a* `' C
document.write('</td></table>')
! S E- k( M8 x( k( J}9 u6 y% D, s) q* R& u
}- E P- a0 N% d
</script> |
|