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

|
网页之跑马灯文字特效
//修改宽度
: x" _, q1 ~: Cvar marqueewidth=300
4 o4 J6 W U- A, C5 Z; X& \6 \3 ^6 ~7 r//高度0 p' ]5 i: U: R2 A o* p
var marqueeheight=25! p: Z5 B2 B* l H7 j8 b
//速度(1-10): T: |6 L) D, c3 V/ c9 t
var marqueespeed=30 `1 a8 s: h* f B* M* S2 s8 t
//背景颜色
1 v! i1 O' U4 u6 K; m+ Y2 Nvar marqueebgcolor="#FFFFFF"! S3 Y6 W! M! `* c
//是否能暂停 (0=no. 1=yes)?3 v) F7 Z1 z* f, w; ?. j, v
var pauseit=1; S* g) f! e7 ?1 C) P4 p
0 y; N/ B+ {: b, h( E1 J) U
//修改显示内容7 o7 F* [! }9 I g) y
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
. I. I0 b8 t6 @1 s& H1 D7 h) E5 {! ~( C" K
1 Z9 s0 S% D0 A0 M
////下面不需改变///////////// ~: u+ h/ u. O5 ^" ]2 C. x
0 s% c0 G" D) H! U, E" C9 F0 {var copyspeed=marqueespeed) m' i. C8 W8 }
var pausespeed=(pauseit==0)? copyspeed: 0
' t- I6 m; z& x f) p1 g; ]2 s7 g4 Fvar iedom=document.all||document.getElementById
. {3 \. f9 a2 C# ~; U. U+ fif (iedom)
/ \! U$ Z8 I* K% g, ]8 P* n% U/ ^* wdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')" B, q8 Z$ ?! i% P* n( E e
var actualwidth=''; F& R" S d1 Q% p
var cross_marquee, ns_marquee. l% B& k: w8 ]7 V: _% R
0 c8 Z& F: b8 h; }$ |function populate(){6 E k. _0 v! I# [9 W8 v
if (iedom){/ t/ i- n1 S$ P& A/ u
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee0 H1 X2 b1 }( H0 D2 h' _1 K
cross_marquee.style.left=marqueewidth+8
# g" k4 m# R8 n' Jcross_marquee.innerHTML=marqueecontent
$ v0 l+ l6 U/ g& [actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth% M& E! l" _: g" p8 r; F
}
$ t% b* P% y3 F7 O0 ielse if (document.layers){
+ ^0 I2 h- ?- H- [2 U/ `ns_marquee=document.ns_marquee.document.ns_marquee2
1 p' A2 q l& zns_marquee.left=marqueewidth+8; w4 j) Z6 S% i) K
ns_marquee.document.write(marqueecontent)! S. z9 u- j4 p
ns_marquee.document.close()
9 A3 _6 _: y8 `6 U2 Sactualwidth=ns_marquee.document.width
0 u4 O0 [/ ^, |4 b/ h4 b}
* Q7 T% [9 L2 @lefttime=setInterval("scrollmarquee()",20)' X4 U& t% T$ L
}. z0 K' n6 ^" O1 L3 e
window.onload=populate
8 O# o- e# Z C& ^# Y9 u
5 O/ ?. S: j; p, F; D, \function scrollmarquee(){# H9 P4 j3 @9 ~1 |
if (iedom){' d/ B, o/ x+ ~
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))* c8 w# E% a% ]8 \+ V& l8 w
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed; V# l# m3 R0 d$ T! |( P; A8 }9 N
else5 |6 T X. E u6 r7 Y- Q
cross_marquee.style.left=marqueewidth+8
3 f V$ u. g* `0 }2 t% b) a1 ?6 v/ p5 I+ e& c+ `, r( V5 P
}% Q: M+ L/ Z, A7 h9 q
else if (document.layers){
& A( s# z" t4 o" D( H% b F% yif (ns_marquee.left>(actualwidth*(-1)+8))
& R; L) I, u6 o i8 Vns_marquee.left-=copyspeed$ p3 I/ t% R6 D: \+ R
else; s/ a$ i4 z# G9 W
ns_marquee.left=marqueewidth+8
6 R, h/ K, a2 D; E Q0 @* W- Y}8 z$ x# h* v; b1 i
}0 g+ n* ^6 i- p5 o$ Y+ v1 B
! [) z" t4 y5 G8 t; X; s; Xif (iedom||document.layers){0 i+ ^$ L$ A5 Y6 d
with (document){$ |5 T7 }0 h" F5 {: s; n1 H: \
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'); G% k" x2 U; M
if (iedom){7 n) E- s& M8 x) [4 O# f
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
0 s" g8 T7 }' i+ B; W* Twrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')7 E2 L$ H5 G6 o- w
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')3 B2 S9 i2 d- y2 h
write('</div>')
5 p1 I: d! q+ o+ M) @2 A9 b}
/ L& R5 E( [- Xelse if (document.layers){
+ `: d0 C* e1 U5 D' O" m5 `write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
0 ^! c8 H+ H6 C, E* Kwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')/ k" W3 u) t9 z- Q
write('</ilayer>')! b6 M$ L9 ~. j6 r
}
# R6 x$ R% m0 ]) w8 ?document.write('</td></table>')
8 a, S' u; Y( I! t: V0 H/ `# Q}& g d! v5 t' s9 z( k, ~9 Y: T' v/ ^& C
}
. E) n4 B5 G9 v. w9 z</script> |
|