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

|
网页之跑马灯文字特效
//修改宽度 K8 V! I: ~6 A! n0 {
var marqueewidth=300( ^: \' p( u: y5 N4 e* b
//高度9 d. ~2 p- N. O) e; y; k ^
var marqueeheight=25
: p: v. H5 h( F" D4 k//速度(1-10)$ M- Y& @! [ V, O7 I' N
var marqueespeed=3: {' h3 W* R8 R7 u8 t
//背景颜色
8 u6 i7 @, p0 n$ E# Fvar marqueebgcolor="#FFFFFF"' B( Z8 v# C8 g% X0 i. z4 x
//是否能暂停 (0=no. 1=yes)?
1 B7 l5 a; i$ xvar pauseit=1
+ y# P, f/ s7 B* }* [ N
6 o% Z, P# r3 {5 g+ N ^4 p//修改显示内容, p! s' X6 o3 z/ E$ ]. F
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
1 N6 r6 v7 C( B g- v, {7 p1 y" p0 `0 T: S
; A4 c5 N- P) M1 T, H$ V5 _
////下面不需改变////////////
O/ y" ]5 B2 _( L4 g1 ~+ f) d6 d5 P3 F/ J6 n7 S6 C% q
var copyspeed=marqueespeed
& K* o7 K! B3 i0 ovar pausespeed=(pauseit==0)? copyspeed: 0
) p& ^9 A; i; |4 Pvar iedom=document.all||document.getElementById8 L+ I v0 y7 h2 Y
if (iedom)7 M) ~5 w, {$ e* B; j
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
7 f$ r6 s# e ~7 R/ Avar actualwidth=''! q, ^; T4 K0 `7 ~
var cross_marquee, ns_marquee9 L/ u. j) \" G# x0 L: X, z G2 o. E
( B% _6 K2 h9 y( n8 Ufunction populate(){, k0 c; X, V- }& b( }* }$ \; e
if (iedom){! M7 s5 i/ _; K6 @2 K3 M
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
! n' d2 l# v- p: h! l% F0 {cross_marquee.style.left=marqueewidth+8
& J0 ^7 H. \1 M5 l# Tcross_marquee.innerHTML=marqueecontent
$ }/ u) S7 s8 X2 Vactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
9 H. d& `( Z: V: B}
% E5 ~. B& @( ]. @6 v- Aelse if (document.layers){1 M/ P6 ]3 U; {8 B/ J5 w+ h
ns_marquee=document.ns_marquee.document.ns_marquee2
" ^& M! N% E- u; o" Cns_marquee.left=marqueewidth+8 R T! R0 P2 T
ns_marquee.document.write(marqueecontent)
0 F, @; a4 j& ~ns_marquee.document.close()
1 ?: `' v5 X! `8 ^0 L, S" Z1 Pactualwidth=ns_marquee.document.width
! H5 z9 Z# A% }2 n} N9 \/ u# U; Q7 X! t) [
lefttime=setInterval("scrollmarquee()",20)3 E/ a( C3 {& i1 z8 m
}
, c1 \" k$ C- ~) e+ I& ]" Z5 v$ Uwindow.onload=populate# u! W3 \" o& V8 |6 P2 u P, P
1 N+ v; `2 W, [/ {8 zfunction scrollmarquee(){
/ F8 {/ M. p* R# aif (iedom){
, B& |# z& L% V; Rif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
$ m& }2 M! n2 s @' f0 B+ o3 [cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
2 H1 s9 p) a) j) h) s- [else
" x) P( [% \- Xcross_marquee.style.left=marqueewidth+8# z3 K! Z7 \: {/ c2 T" a
/ n6 E9 U: s- P% W
}
2 I8 w% _1 w7 o) J f: | ?6 nelse if (document.layers){
* }1 p9 _3 d) S Z& mif (ns_marquee.left>(actualwidth*(-1)+8))
5 _$ _- {- k8 C$ Yns_marquee.left-=copyspeed* G9 n Z7 [: B
else
' `4 ?+ _$ D% ]" d; Y& s* sns_marquee.left=marqueewidth+8$ R) j+ X. k. D- W
}+ H0 {5 ]( T. X/ L: A. H; a
}
, c, I6 j$ N" Q( n Q g* k1 P) I. I$ c
if (iedom||document.layers){
0 H# H( N1 n; J5 swith (document){ W" B0 O. V1 C- _; \: [& @
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
! f6 M8 E2 ^2 J y0 I# uif (iedom){/ R, {8 f5 s! S' H# u- R. @
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
- Q9 S2 T/ h: h: l1 y$ qwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
. I+ Q& w, e- L$ Jwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')# a& V0 C* Q+ a4 X; K0 [6 s
write('</div>')$ ^; \) W+ \$ x7 O6 o
}4 j6 ?7 i3 n% D" _5 Z( Z
else if (document.layers){( H9 F, g( U5 x
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
* Y. Y- t, Z( B/ p% Q' cwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')7 \, c7 q5 q# h/ }9 T+ S; t
write('</ilayer>')
; |0 j" ^! l1 Z2 X, z}% H5 M6 H0 ?$ r- }
document.write('</td></table>')# B7 O; U+ t+ v3 w( t
}: I1 o b h. w
}
# B. w/ Z, ]" [; }</script> |
|