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

|
网页之跑马灯文字特效
//修改宽度9 b i [6 }7 b2 ^: b
var marqueewidth=3007 t+ R# M# r: v: e/ P! ~1 T+ Y
//高度
5 m4 P4 B* d% x4 o0 p9 xvar marqueeheight=25. s0 Z3 S% |2 v9 U. S5 ]
//速度(1-10)
. d; Q" X4 r" F6 s6 W, ]2 gvar marqueespeed=3) B, D4 q: ^ x9 m
//背景颜色
& z! U1 u1 w5 r, `. ~$ E2 ovar marqueebgcolor="#FFFFFF"
# V- {/ ~+ l9 k: \0 q//是否能暂停 (0=no. 1=yes)?$ A: @4 f9 }! F8 v7 B% [
var pauseit=1
5 p. B% ]4 }/ p- _1 T* B- ]. G$ v" w5 O: `' G
//修改显示内容1 m4 J8 i) m" o- ]5 h/ {& |9 W D
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
+ N1 B, u0 P: n& h6 \' e5 l/ E# b3 k3 B0 ~1 d) h$ C
& ^2 \% x+ h# \////下面不需改变////////////0 x8 n" ]( [1 H0 v% t- j+ }+ A7 x
6 V9 [' q |* l) Y1 G; u. W4 Cvar copyspeed=marqueespeed0 e% ~: x2 Q- D. D3 r. E" U
var pausespeed=(pauseit==0)? copyspeed: 0
8 ~' @ e% C% P% u) Bvar iedom=document.all||document.getElementById `- B2 N* s: Z" H. z, q4 p
if (iedom)* M$ T( c& n# X0 p; O+ B
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
$ V) F, r- C) z+ n) C4 d7 fvar actualwidth=''
3 v" l0 N/ d& L( dvar cross_marquee, ns_marquee
8 F; I: k* }9 V. U2 [4 v! q! Z \. y8 C) `* B% x ]! K9 V
function populate(){
3 v) N/ x! o$ Y0 xif (iedom){
5 ]( S6 _: k4 k, ncross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
2 k/ c% N- M/ J$ t* u% x/ Fcross_marquee.style.left=marqueewidth+8
! }6 j! c* l: J; A0 Xcross_marquee.innerHTML=marqueecontent
; z8 D2 W# R# Eactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth5 w1 d8 X) i, J2 \5 M8 ^% O; E( n
}. q, F0 }, ~* @1 D
else if (document.layers){
( V8 I' s, O' B4 u& {! h# Tns_marquee=document.ns_marquee.document.ns_marquee2
( P2 R/ @1 ^9 ^5 X; ~- h/ I1 Kns_marquee.left=marqueewidth+8# l+ P) r; ]' h7 Z% ~" F
ns_marquee.document.write(marqueecontent)
0 ]! g' H) O; c* [" t2 F1 Vns_marquee.document.close()
4 Q) L4 E4 o: @, Y( Mactualwidth=ns_marquee.document.width
: U+ c4 e3 [+ }( P8 p2 ]4 b) {: I}8 s3 s H# c: c
lefttime=setInterval("scrollmarquee()",20)
7 b8 I. O" |5 | j% j2 [: r6 P/ {}$ N3 U( O$ N" I1 |0 t
window.onload=populate
6 F" r) @9 q: z& n, m
% x- P6 L/ T) S. Tfunction scrollmarquee(){+ N: D4 U" K6 K3 W& ]/ o2 U
if (iedom){
2 [# h1 Y6 e. h d2 `) fif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))$ L S( c2 L2 D) [0 ?
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
* H0 W: f. W+ O, \7 n, m3 ^else
9 W! L# P0 D$ m$ f! {# mcross_marquee.style.left=marqueewidth+8" B/ P5 o- b& J3 u; w( r* C
n8 C% `, [) L}
6 X" @+ ]; | t5 a7 @, t2 nelse if (document.layers){
4 m& @& A0 U! a" o0 nif (ns_marquee.left>(actualwidth*(-1)+8))
! M; k: j7 T; K" S: Z3 v) B" c, ens_marquee.left-=copyspeed
4 Z, L+ C; z9 O! Felse; v( y) {9 r' C/ J# _; d1 |0 p1 s
ns_marquee.left=marqueewidth+8
& f1 E, E3 K9 w% O# {2 H o}
, I2 M7 Q6 [ z1 u- W; k}' U4 [$ H$ k. {; y* z- F1 T/ n
W6 V! [2 n0 Y0 Tif (iedom||document.layers){
' Y2 `6 {3 L5 ?' p( V. _with (document){
7 e6 `& N, k6 i2 T! l" l3 Gdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
! B8 l+ N% q0 q6 j4 \if (iedom){' X3 f0 ]0 N8 I6 y
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
+ M6 K3 h0 l7 | ~" Pwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
3 O! k) U9 w! Jwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')* }4 E8 a8 P4 W; x1 y1 l0 J
write('</div>')
7 x9 S9 Z% i0 f4 r; h/ v% d+ B- q}' k% R! B; J8 I. H, j; O5 c( g
else if (document.layers){
$ P( {) f. M7 \write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
3 U8 k* m) L$ iwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')5 u3 `% _; V: ?. k
write('</ilayer>')2 D5 Y0 P; m5 L5 G
}. {1 X& V# y) a$ [- L2 d" H
document.write('</td></table>')& v( |# u) L5 ^ t2 p/ T! l: U
}
$ V: r& y2 t4 t# t6 I! O' `- [}; E& p7 O9 f7 ]9 Y0 m
</script> |
|