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

|
网页之跑马灯文字特效
//修改宽度5 `6 k! J9 J, J, S* i0 A* H/ G
var marqueewidth=300/ I) ]' n, |0 s3 Z1 F
//高度0 U% T& `' T/ z& d9 g9 f5 p8 P
var marqueeheight=25( ^* W$ A- T$ i6 U7 G
//速度(1-10)
! z5 x% T7 U4 _$ x2 jvar marqueespeed=3
# i/ |' e) o1 a/ Y//背景颜色7 N/ g0 V2 N8 ?: [; C) R# i1 y2 }
var marqueebgcolor="#FFFFFF"' I. M8 v/ b6 A/ L8 F
//是否能暂停 (0=no. 1=yes)?, `, \4 g# R/ F' Q
var pauseit=1
( W* ?; W4 Y: i: _% `- N
( J/ z j& }$ ]( K }! S$ o//修改显示内容$ K- V3 o# D4 L2 ^
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
( }' Y9 q! |: T( V; C5 a
3 {/ c- c& S8 K% M- B# D# s" x
0 @+ G) P7 \ M1 X7 g2 A& K////下面不需改变////////////& n7 r7 j3 X4 j: Y
# v: t+ @/ l. a' Evar copyspeed=marqueespeed
9 M1 W `- ]; Z4 t$ O4 cvar pausespeed=(pauseit==0)? copyspeed: 0 X; l- Q/ k0 L( F( a+ d) j7 v$ [$ ?
var iedom=document.all||document.getElementById
O0 v0 _4 P2 R% P6 Gif (iedom)# f6 G6 I J- `3 X4 |' v/ T
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')5 e- w) w/ G4 i$ t
var actualwidth=''# w: L4 M' c& h" s* }( _' ?6 M: r4 c+ }
var cross_marquee, ns_marquee {1 M4 A% r7 D. S4 G
o* {* e" y8 t; v3 C+ A" Nfunction populate(){
$ h/ m- |* D! \1 F6 Iif (iedom){! A; _# n0 i& E. ~1 u3 O' d
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee+ n% N6 Q6 J/ H& A) `1 A
cross_marquee.style.left=marqueewidth+8& A: S( W" Q' |" [/ u Q% d
cross_marquee.innerHTML=marqueecontent
8 p5 x/ s5 }( p6 Dactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth% A6 v9 r, B2 ^2 i7 z: L/ H( U
}
) R8 W s" J. \% Q0 Selse if (document.layers){
7 Q4 D5 n+ L, ~9 Sns_marquee=document.ns_marquee.document.ns_marquee2
K/ m5 T: K4 ~ns_marquee.left=marqueewidth+8& @1 t1 o4 `% y: y9 t; D
ns_marquee.document.write(marqueecontent)
i) b0 Z3 I- r" |* k* Fns_marquee.document.close()' U% M" }3 O0 q, J* a9 p
actualwidth=ns_marquee.document.width
, g; z: }- z Q& M) H+ ?. O1 l}1 U0 |) C: W2 [( I+ n
lefttime=setInterval("scrollmarquee()",20)
3 H5 K/ |5 \. [8 O7 m* _}
% L7 _% j4 z3 X4 n! Awindow.onload=populate
% ^/ O Y) c) k- b+ n- `7 f c, h* e, n. B
function scrollmarquee(){
: D% B+ j$ G+ p3 o, Bif (iedom){( ^ g) {1 {: M+ e& a$ ]0 u- ]
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))7 O9 n: Y5 Y" L- o4 ]- d* z
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+ Y9 y( C$ G/ u; \# Z' f6 L
else( T7 f& K0 I, ]
cross_marquee.style.left=marqueewidth+84 N) k9 {1 {' y9 E2 [) h) E
8 ]. B7 g" N, E, B& a) ^
}
4 A0 _: ~/ S" H m+ Z- O$ S7 Celse if (document.layers){% d) u9 n5 q) V' _! b
if (ns_marquee.left>(actualwidth*(-1)+8))3 x' d, M$ P! S7 ?
ns_marquee.left-=copyspeed4 t' I+ f9 [ F/ e: o- I# a
else# r5 Q5 j( R0 Q& Y- [7 S
ns_marquee.left=marqueewidth+8' B3 D: E8 e2 O" T9 P
}
) V" s2 t: b; t}
$ r5 O g( \ K' Y
# s) _, p2 p" H, tif (iedom||document.layers){" u6 E; _* I! ]) z3 k7 u
with (document){( ~# ~3 ^! p4 _7 J, a `; T7 Y
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
/ T8 w% z" ?& }/ M3 G( Nif (iedom){
& _* O8 h" P% G8 d2 Gwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
4 o8 i6 y) j8 W% `; m; [4 Uwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'); y: n1 e) x2 o* H1 h
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
5 g# |. |& Q5 H7 U( S% s/ N% _write('</div>')8 F7 ^' |! K. R1 ^ X' E! c
}0 R4 o) s2 R1 H( \5 H0 {
else if (document.layers){
9 m; F9 P) T {0 N/ B. t: }write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'), ?$ j ]' {% R o- C( @1 v2 U6 Z
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
1 j, c, l2 {2 T* b0 ]: p3 m rwrite('</ilayer>')
; F. I$ I) C+ R- L L! n}* }+ P2 T+ G7 U) S, J; A: o# p
document.write('</td></table>')
9 }! s" A$ G8 F, S: p/ ]4 F}: i" t% @$ F7 }
}7 M; y o0 ?& Y
</script> |
|