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

|
网页之跑马灯文字特效
//修改宽度
: O1 Y: U4 ?, lvar marqueewidth=300- S7 s* O$ [ H P; N* l U
//高度 Q+ I/ `) `; n
var marqueeheight=253 X# H. @4 ^/ Q6 ]/ f# U
//速度(1-10)" H) b+ ~7 X, M" P! r+ B0 a
var marqueespeed=3
' X3 x" R) l$ ? F f//背景颜色
# Z1 w7 n0 u {: G1 J/ w* |5 Avar marqueebgcolor="#FFFFFF"$ D9 x: r, k$ w. v6 i- K
//是否能暂停 (0=no. 1=yes)?; G- G9 m, V0 Z
var pauseit=18 k) V: c4 d! g; m$ H
+ p- f/ Q' W" l6 S- k
//修改显示内容# S8 ` J7 h# U+ }
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
" r5 @+ n9 S; o" e2 I3 @1 K- r
2 ^! n7 c% d8 E9 h& H7 Q+ U1 j3 m* ~) d5 p/ C+ B
////下面不需改变////////////
. ]7 g+ {3 v' L5 a2 n; `( k; A% O- l. H/ K
var copyspeed=marqueespeed8 T. @( i9 s# D. p2 ?% H1 R
var pausespeed=(pauseit==0)? copyspeed: 0
8 I4 b3 G2 J' Evar iedom=document.all||document.getElementById7 p! E# ^" n" F. Z8 M
if (iedom)
" I" _; D* h' b: B, Zdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
, q8 r6 n2 t$ tvar actualwidth=''
e$ @7 C7 u/ w2 C7 V$ {var cross_marquee, ns_marquee
9 i t7 Q0 |; `$ ~+ q+ [& i$ ]' q
! k6 ?0 k! R. @+ c; I. d/ b9 qfunction populate(){. w- F! U3 K6 l5 Y5 {( w1 F
if (iedom){" Q: w( i' }4 I# \
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee4 f4 I2 I" i2 A* O
cross_marquee.style.left=marqueewidth+83 @! l# A+ a1 P& Z
cross_marquee.innerHTML=marqueecontent
4 i8 N7 V9 b; C6 R. ~3 Iactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth9 ]6 [+ z0 t" e }
}
1 J' a9 F% ^! v% b: p& Jelse if (document.layers){
* o4 a+ _7 r* }7 Y& c8 Pns_marquee=document.ns_marquee.document.ns_marquee27 E& o( o8 S2 V" I n% @
ns_marquee.left=marqueewidth+8
5 v9 K. r4 f2 I: G( H Ans_marquee.document.write(marqueecontent)+ e+ l# |% d9 D/ t
ns_marquee.document.close()
: c" R. p: S: S( e" {+ X& Bactualwidth=ns_marquee.document.width; z0 z s$ L/ N
}, o" d `; m- i8 S
lefttime=setInterval("scrollmarquee()",20)
( I' i1 h9 u, Z+ c% C}# ^: J3 _1 e4 m( A+ q, L' I, a7 |/ v; a
window.onload=populate# q. m. B8 O9 s& u& P$ V
5 H2 D, f; V4 _( f$ ^( l, b
function scrollmarquee(){- y$ k( ?9 O) K# B' i; o
if (iedom){5 m- i X/ C0 V& n
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)). ]9 N8 N: _, S+ u) X. }1 t% E
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
7 k# Y; t; Y: Z R! @. g3 ^1 G, N% Aelse, e, h: U( k/ c0 M
cross_marquee.style.left=marqueewidth+83 X1 o7 |2 _4 T8 E
; e7 g& M) P. ?7 ?}
" i+ P: E. l( k0 Oelse if (document.layers){3 u; q% J0 r, X- i5 O% R
if (ns_marquee.left>(actualwidth*(-1)+8))! M& @. N" ?& k9 W6 u
ns_marquee.left-=copyspeed
' N3 Y- J% ]. xelse& a, T/ l' b P8 u: x
ns_marquee.left=marqueewidth+8
% q, d9 j! i: V. J' f0 {}
9 Y1 M# @" ~, u2 f0 y}
# {* `$ R l" h @" a( t3 B/ {& K' ?* J# E% \( V5 C
if (iedom||document.layers){
. e, m" ^5 d9 Kwith (document){
4 Y4 q0 J! @+ v( S8 |' O/ Xdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')9 e+ w$ c% A& o, z4 s
if (iedom){
% r2 D% g5 e" [" m4 Vwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
% N+ z! z9 a! A; w: ]4 jwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'); A" s7 L, H0 L6 O) a/ W! L5 N
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
* z: j+ f* _6 U& p0 s# T! M+ Qwrite('</div>')3 ^( Z# C& q; `+ h/ V( L ^
}* `% b, \2 U3 d: U* Q* s8 H) f1 p
else if (document.layers){
3 u" \- p0 A. G: j) ?' o5 Twrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
$ z) J. v" f+ g( F% d- q" ]write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
) \% x& B. j0 R0 ]) n9 M% {write('</ilayer>')
: e; O, a# U* j: n}9 ~! H8 D( P, @. u* u+ d- z6 M
document.write('</td></table>'), k% E+ z6 T* s& s5 @- n
}5 K1 J* {1 R( W
}' w% n% G! X0 j9 q, L
</script> |
|