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

|
网页之跑马灯文字特效
//修改宽度4 u X* h ^& r! q" l
var marqueewidth=300& |0 E. O5 W/ ^+ Y/ \
//高度
7 B |8 d. Q+ ~4 l$ Svar marqueeheight=25
! O# b \0 \' a5 A7 a: o1 j( [//速度(1-10); I3 O- c+ |# U1 p
var marqueespeed=3
8 r l! r: G! r; g5 m& `9 u$ Y& y//背景颜色
9 o& \& |- P( B3 O- _8 v/ {0 i$ @var marqueebgcolor="#FFFFFF"
# a& K( Y: V3 R//是否能暂停 (0=no. 1=yes)?) D) L/ B( N f4 ?1 C- u5 A" S
var pauseit=1
& a M& f! c, W- q9 `
9 C, R W# W( n. R//修改显示内容0 Z. V: l3 P% Q4 H6 v6 G2 d
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
/ H& A2 m# x+ b0 f: p; _. j
) G* a3 n. M3 k
$ u2 y4 [' y! E" |% v1 A F: U////下面不需改变////////////3 Q& Z4 x. T7 Z$ U4 \& m: Q
; a/ E) L* L% X6 t6 G0 a4 M- M
var copyspeed=marqueespeed' w( I% g+ s" F8 w
var pausespeed=(pauseit==0)? copyspeed: 0
& c5 g* w3 s, N0 O+ r" l$ nvar iedom=document.all||document.getElementById
# Q# j3 M) w3 A q1 d: C$ d( Q* C' Wif (iedom)6 x( v1 P7 T) F, d* o
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
$ t- m, K, o" Pvar actualwidth=''; o0 R5 f- i) ~4 I) `- x* G
var cross_marquee, ns_marquee
" X" h. o% u( V+ L6 h: E! A) \
& ]& Q2 Y4 ?& U& q& K* u) Lfunction populate(){7 `/ `) `+ U" M
if (iedom){4 a: ]9 v7 J6 K& B
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee6 Q4 P( l$ u. N0 k: A1 { C* j4 V
cross_marquee.style.left=marqueewidth+81 ` \; ]. p& E4 F
cross_marquee.innerHTML=marqueecontent
9 w; l" _, V9 h9 bactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
; [9 v8 n, Q$ t) R" J! l# `9 w5 E}
$ @3 n/ [) l$ R' v$ ]else if (document.layers){) u- z* f. R/ D* G6 V- M2 _1 l
ns_marquee=document.ns_marquee.document.ns_marquee22 h4 W1 }8 v2 ^* h6 a% X) [+ e
ns_marquee.left=marqueewidth+8, L) c2 C$ I, _7 t
ns_marquee.document.write(marqueecontent); q3 B, Y' L7 v' j5 L! ?
ns_marquee.document.close()1 r$ V6 K% e. D) w: T
actualwidth=ns_marquee.document.width
. e% ?1 T' T t4 u, }- s( B7 m5 i} X- g. y( h3 g% m
lefttime=setInterval("scrollmarquee()",20)3 F6 G$ x; M2 d1 j, a; g! W
}( C7 X1 _* P* y! K' z" u0 y
window.onload=populate
, Q7 z& }! W% H1 | u( e/ G- u# C0 w6 J8 y0 r6 b8 k
function scrollmarquee(){
% _0 R! ?# \$ |' d! pif (iedom){5 `4 S4 I3 X# Z0 Z4 k* N$ |1 T; D1 ~# e
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))/ j5 w$ W( U: |) q4 \( h* D3 Q
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed, M! u+ D0 U# ~% i
else
& Z( B/ c1 ~% x1 Vcross_marquee.style.left=marqueewidth+8
& g7 Q8 s) U- g3 U) @$ E1 N7 a. _1 G3 }& \ j; E& V5 s' ~% M
}
* W8 |7 k& H3 |5 w0 Helse if (document.layers){# v: z; s( y/ R _/ t
if (ns_marquee.left>(actualwidth*(-1)+8))) L/ r" N5 V2 W1 G& V; F+ O* m( _$ I
ns_marquee.left-=copyspeed
5 ]! g$ q6 k) zelse
( d) d8 H3 ]0 C, w5 C$ F5 R2 Ans_marquee.left=marqueewidth+88 U5 o. x/ X" U( z! r) X4 t! F! C2 P
}
* s, `* F! l- m7 _' [}) R; J- W/ c8 i6 q
9 M0 G6 f! |- ~" p2 r
if (iedom||document.layers){
# D% A% q7 S$ r$ |; qwith (document){3 C! m& N( ^+ G
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
' B1 I; _. Q, q2 U$ F- C1 Xif (iedom){
; i* z0 y+ h- `- O2 mwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')# ~2 Y$ d, s2 C+ J
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
& H& ]. o! J- iwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>') [" K6 j t) O6 h2 X: A8 K
write('</div>')" r7 P; [7 m& V( Q* d1 \3 c
}* X; {2 _9 `( ]0 @/ d0 x: v
else if (document.layers){ P5 Z# @ O u& n
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')# T! z5 e6 i7 Q' F
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')0 G+ W0 ]# [; o. P- h% W& |1 c
write('</ilayer>')
) Z( y9 Y5 C( U; b}1 E: i/ @- c2 D* s
document.write('</td></table>')
& k" f, T" g5 C/ @$ @% i' S}& T6 w; s1 U4 ]
}
! r, [: o# o% B# [+ t+ k6 {</script> |
|