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

|
网页之跑马灯文字特效
//修改宽度3 q( s0 x1 r0 v9 [8 b
var marqueewidth=300
8 V( s: c1 U% D% X0 y$ `- m//高度+ F3 I% v7 j& a5 {; h# m( _2 i+ \
var marqueeheight=25
) F+ s, n _7 p; i//速度(1-10)
: d8 G" A9 l3 x5 p& ~- Q$ V0 Hvar marqueespeed=3. B5 s" ^5 f- p6 n3 A! z
//背景颜色
) S5 c, C/ X- X2 r* _var marqueebgcolor="#FFFFFF"* N. G/ F, ~; b0 l8 C" e+ E' D6 d
//是否能暂停 (0=no. 1=yes)?* I5 m3 }- ]9 f& ?9 X; P7 e+ _
var pauseit=13 u6 i0 j/ X$ w3 \9 |7 G" C6 V. A
5 F ]* H9 _1 V+ c7 ~: l
//修改显示内容$ k4 y4 I0 E% U' B: O) J1 z
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'8 d2 e( g8 P8 G7 u& T/ R
1 B/ W/ {) {" g, i4 s
3 B( _6 y; }3 B////下面不需改变////////////) J% w/ I# Q/ z( [
* m. W/ H0 b& H- S8 F4 H" fvar copyspeed=marqueespeed L. |0 D# F/ _, H8 d7 p/ j6 s
var pausespeed=(pauseit==0)? copyspeed: 02 d( W& v- Z0 `5 F9 c8 U k- C
var iedom=document.all||document.getElementById
W6 D: ?' K7 o9 a& kif (iedom)
+ t8 g w4 i' X# jdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')$ P! P2 p% e9 c2 j: R+ `! Q6 u7 e
var actualwidth=''
% A& {# r" _- @: x0 g: z7 Z2 pvar cross_marquee, ns_marquee
( |+ w& Z" ^1 x7 }- |/ T; z% {# }# s+ T
function populate(){0 S- ?0 B9 u0 u' y( L2 J( U1 W
if (iedom){
# D* X! r$ z) [4 Bcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee- l0 A, \4 M. M9 z$ |
cross_marquee.style.left=marqueewidth+8
3 A; v4 X2 z8 ^9 _* ecross_marquee.innerHTML=marqueecontent
) G: a P" P4 ]5 kactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
2 D) t, R2 q+ z/ _: g}. L1 \8 |% u& I4 I* e# y v" Z
else if (document.layers){5 T) V# F" q. p* K% g& J) r% L
ns_marquee=document.ns_marquee.document.ns_marquee23 f, D5 w# C2 N# w% x
ns_marquee.left=marqueewidth+85 ?* R3 Z' R, h7 v
ns_marquee.document.write(marqueecontent)
1 i# M/ j/ ?8 Kns_marquee.document.close()
( `( |" E. e) G5 l9 g% O% V9 gactualwidth=ns_marquee.document.width. f$ s. h8 h2 w/ j. m/ u* k4 S
}
8 B+ r5 J0 h: Z8 llefttime=setInterval("scrollmarquee()",20)+ s& ]2 l+ w3 q* h0 T; g7 \( V
}
% s# L+ A1 t# _window.onload=populate$ v0 Z! Y+ X, M! k' b5 V. h. i
; Y$ u6 R& e; @function scrollmarquee(){* \2 M! i4 t6 S/ p4 w( m7 N2 V
if (iedom){
! j6 R* K `# H9 D( {if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
4 N' l$ i) a+ ~0 t( N7 ecross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
0 q& p2 c. a/ aelse
; b; ^! g* H$ S/ j% d Lcross_marquee.style.left=marqueewidth+8
" E% o0 v9 W2 G
O. E5 \. }: Y3 G}0 Z- |7 P$ k, C$ L# b3 H" s
else if (document.layers){. r" e& z7 ?8 d+ W) W
if (ns_marquee.left>(actualwidth*(-1)+8))
$ ^4 W, R9 }3 W+ @4 h& A Gns_marquee.left-=copyspeed
3 ~4 U6 a% B8 N T4 B0 `: ?% Selse4 t- J9 ]2 ?6 l3 r1 P
ns_marquee.left=marqueewidth+8
- Y# |5 l( O" Q1 G# O% Z; d& a}; p. J6 p( m: S3 i, l$ `; }
}) ^9 p2 M' G( `( m3 m+ }6 X( h
3 T+ {4 f I8 ]! N' j- dif (iedom||document.layers){- v) X( Y4 x* m: Q, P
with (document){
4 a7 I' u8 d1 b7 F2 a* e; odocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
7 x' ]* t1 u# R) p1 ~if (iedom){4 {+ E4 o' P6 S l; G2 ]
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
9 ?7 o, u+ }6 t' |2 U k. Swrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')- {5 ?3 C# P3 C; Z9 N
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
4 o4 q$ N" f6 `, c. }' F' v9 swrite('</div>')
2 n/ ?* ~9 A) {+ }; k/ ^7 U0 @}
) `! d8 t( ~) i, K' Helse if (document.layers){# c3 c+ S! T0 x
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
9 E. d5 U6 [5 f. a4 w) Lwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'); |! q j% l, j, V3 I4 i7 P
write('</ilayer>')
: t1 }- W3 G& m8 K}" e, A6 H7 q- t$ N
document.write('</td></table>'): Z7 \ y( A( h; W2 B
}
$ w3 K6 u$ R: K4 H5 h}4 s: p2 k& b# _ P- l, {( _: f
</script> |
|