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

|
网页之跑马灯文字特效
//修改宽度5 f. |# o& }4 F9 J; k
var marqueewidth=300
3 I; L% r# x3 r' b, x//高度
# w, H! V+ H7 ]1 @# }var marqueeheight=25 y/ N0 c$ N7 N% F, D: p
//速度(1-10)
5 Z- N! C3 N9 m5 c5 p+ T7 u: r5 Yvar marqueespeed=3% c0 J8 N+ [, p2 Y- d2 w- `- e
//背景颜色
9 L( Q# K, I) i5 Mvar marqueebgcolor="#FFFFFF"+ T- g& i4 ?+ m+ \+ c& d$ f( }; p
//是否能暂停 (0=no. 1=yes)?2 @5 t+ n% a4 h/ I# w5 F) e
var pauseit=1
$ g: b+ \0 Z' V- ^, n b' J& b
0 v+ m( j9 [0 P* C4 A//修改显示内容( h- ^5 r1 |) O% Z
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'/ u. P1 [4 y |* J1 n! ]
% ^* E7 w0 e$ j/ W' V3 ^. l" @0 z" u( h- J
////下面不需改变////////////. j/ P8 X& j* F" k
; |& B% D0 d: U- @4 hvar copyspeed=marqueespeed
' a0 d. M) E9 w- m+ rvar pausespeed=(pauseit==0)? copyspeed: 04 t3 B5 |' i3 s% G+ |
var iedom=document.all||document.getElementById
4 d3 b# r/ L1 M7 Aif (iedom)
/ Z+ H( @- ^8 s4 E9 L7 tdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')! T1 J2 p2 E, }' M
var actualwidth='' m r r8 X/ L, y
var cross_marquee, ns_marquee
8 q% |+ {/ ?4 O6 p, `4 z$ r* F" ^4 ^+ x9 I
function populate(){' O4 E1 k5 e3 n+ K' a4 I/ S
if (iedom){
" X3 Z( Y& T1 s4 t0 V6 f- F/ Ocross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
k( M0 I$ S% n& u H: {cross_marquee.style.left=marqueewidth+8
( j! L1 _0 m$ U# l) lcross_marquee.innerHTML=marqueecontent. g _- j$ n, ?5 O/ J
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth7 E/ S% }( v+ Z0 u# f- A- B
}* R- d5 z' o" k" X0 S
else if (document.layers){; r% M' V$ @ C; }$ O# A
ns_marquee=document.ns_marquee.document.ns_marquee2
: ?+ x8 N5 u) V# P {ns_marquee.left=marqueewidth+85 \9 z2 W7 V; D' t- b5 }
ns_marquee.document.write(marqueecontent)
2 ^1 l: d& I( s7 u7 Bns_marquee.document.close()
\1 n+ O, }; F0 b, hactualwidth=ns_marquee.document.width1 K; l% V+ A1 p/ K% w, _# A$ j
}
0 ?2 H) _5 ^+ E4 Z6 D1 ]- }# ilefttime=setInterval("scrollmarquee()",20)0 Z: X$ ^' s# p' |
}, Q! a* I3 B' _ i* J+ ]
window.onload=populate* U1 n+ N5 d% t
; K2 A6 E I; O1 _+ U8 yfunction scrollmarquee(){
5 H3 o) I, P6 M; n( o% a7 b. lif (iedom){" [( x/ Z! e3 I1 [2 g9 W, U: `8 C7 J
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
( m6 d: T* y- N% c5 Q) ^cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed" E5 n. p9 p. }, ?+ P9 s" \7 o8 r
else2 w0 }3 @$ v) ?0 c( q! [
cross_marquee.style.left=marqueewidth+86 S3 D. N3 a$ t: u6 M" _# A" E
9 x( r+ W4 N3 X5 K: ?- T}3 n }$ ^3 V3 N3 l' ?3 R% S
else if (document.layers){: n) q: L/ h1 ?- p/ I, [- q- V, Y
if (ns_marquee.left>(actualwidth*(-1)+8)), c% r3 v. z( `3 m
ns_marquee.left-=copyspeed
( ~/ _& ?# P2 h, a' J _& lelse
3 V, t, @$ ]0 Y% I" q) [$ Dns_marquee.left=marqueewidth+8- w& }' k" G) B8 {8 }5 r- T
}/ t" v8 G' R* {5 t' I) u
}
+ L4 r! I. ~, {8 Q3 S! c4 N: h# p* i3 Z. U; r" Z# s
if (iedom||document.layers){
; j5 f4 o: K+ L) R; C) E2 {with (document){
B; g. ]- f1 q! C- p5 J$ mdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'). W; A9 S# ?, w+ ^" A# |' A
if (iedom){) v" l# J+ R$ Y6 B. q8 Z, J
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')6 l: U- u8 T/ _# }% w+ V
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')+ k' Q% o/ Q, X: E
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')5 H4 S& l2 q4 S# I- B
write('</div>')! A# d: K$ H$ j: w, X! S
}0 c2 m9 G: X( N8 T
else if (document.layers){+ ]) J6 O6 d/ Q' x1 k! j4 j. ? ~+ F
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')3 o4 E0 U5 f- b' z: ]/ T: e: b
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')" ?9 p8 r& F, N; g5 i. Z
write('</ilayer>')8 n" f/ X- H$ r8 k0 m3 |
}
% L1 T& Z( G8 g9 _* [! d% _' C1 Ndocument.write('</td></table>')
7 c4 ]( q4 M7 v}
# W& k. J* C, g0 b* W}
7 W% k; f( y+ \9 D</script> |
|