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

|
网页之跑马灯文字特效
//修改宽度
3 M+ @+ H/ A2 R2 l1 S+ Nvar marqueewidth=300
$ n: [+ y( A7 o, L//高度
3 \1 H- ~, f) U- E( a8 Dvar marqueeheight=25
* J. ]* F! a1 I$ ^( J$ p//速度(1-10)( \: |( I9 A! \8 o
var marqueespeed=3
( e5 }$ Y% u5 @1 h4 b; a//背景颜色0 z: |, N C) d7 D
var marqueebgcolor="#FFFFFF": |: {' ^: ]/ |8 T3 C3 }' w
//是否能暂停 (0=no. 1=yes)?8 j; {3 b: F" p" ~3 W
var pauseit=1
" P N9 N& x6 X1 {$ L* h' f, U) S$ N+ U; Z
//修改显示内容- U) @% k) R; a, l( y) ]8 _' a4 H
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
c% S% ?2 a, y, I; p2 v2 a
; s X" W7 U, x8 j; Y8 }7 j
) x x. p8 l4 w9 |# b& ^" C6 P////下面不需改变////////////
# B; t4 w" E+ [+ z: u
* w5 S9 J' |+ |( Evar copyspeed=marqueespeed
% \3 ]. F0 v m Pvar pausespeed=(pauseit==0)? copyspeed: 03 ?- L c: Z6 [- [
var iedom=document.all||document.getElementById
; A% O' P9 b$ ]2 J, mif (iedom)
3 J8 r; A; a8 B, P: E% rdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')' ~+ n6 u) W8 k# s
var actualwidth='': {9 ]- F1 f1 U! P, e
var cross_marquee, ns_marquee9 ?- m& e+ P6 H/ Z5 b: E1 Z# Y- a7 f
. T+ D6 L/ f2 G3 X) W
function populate(){/ k5 g" E$ X y2 D3 q
if (iedom){6 I3 h0 v6 m: e
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
7 k/ t4 p4 x4 U' B: S) U2 V8 Wcross_marquee.style.left=marqueewidth+87 h4 j( R8 q3 ?" a9 ]
cross_marquee.innerHTML=marqueecontent$ v& F1 k/ C# y( @; W( q
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
5 r" H) [' G* W}* i4 X5 ]& f* H- y' B- K7 Z2 h
else if (document.layers){
4 w; P; C# c2 h+ z c: Fns_marquee=document.ns_marquee.document.ns_marquee2
5 m' y# n* n+ l$ b$ J+ @ns_marquee.left=marqueewidth+8" i" ~- [4 U- K. M
ns_marquee.document.write(marqueecontent)
8 [( z A% h( Q. lns_marquee.document.close()0 a# S/ ~' r( b
actualwidth=ns_marquee.document.width
6 C% _1 T' F- {) {6 i, r( |}! s1 W1 `" z( M& F/ y! k! J
lefttime=setInterval("scrollmarquee()",20)( A5 o: z, T+ J
}% Q1 K# \1 m7 K" h1 F. A% e
window.onload=populate
% K# e. ?; p0 {' _
5 ]4 p7 G" f/ Y& u" d- I1 M. pfunction scrollmarquee(){
& n, g3 K* y% L8 u- W9 uif (iedom){
6 H; c$ O9 L, q& F4 s3 u+ Nif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
$ O7 R& n& V7 x( Dcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
6 F& d7 b- P* S' N1 jelse% U0 h' C+ @: ~# s- K; N( M
cross_marquee.style.left=marqueewidth+8
" E. A0 c4 _! W3 G" U0 m. C. ?/ ] O9 l
}
' \8 c4 h+ Q7 m9 q% N% Uelse if (document.layers){
3 i% r1 w4 ]* U! d: c$ ~8 c& }& Oif (ns_marquee.left>(actualwidth*(-1)+8))
+ M S+ A& @+ x0 y- d+ W' tns_marquee.left-=copyspeed
$ y- y: Q& X7 M: J5 R& a) felse% l+ [) \: R: S! y \4 m0 _
ns_marquee.left=marqueewidth+8- d7 ^* l' {1 R; o+ X6 n
}
( z+ |. e# {- Y0 s o}
# H7 Z3 A$ P9 |- ?9 g
& y+ j, G: U& c l* w* b4 x8 eif (iedom||document.layers){
+ N& A$ }& G$ g+ s9 e9 x% m* k3 l/ rwith (document){% `2 z5 b1 g+ I$ A; C, ]5 x/ n. r
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
. _# m1 M8 | m9 s6 }; W: Rif (iedom){
0 R4 ~' X2 P! \5 ewrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')/ @0 V3 x. f1 K3 C. b9 k
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')% A2 |! F2 H# Z+ K2 |3 v' H% U
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')5 D0 O) t# V3 y \6 N
write('</div>'): k1 r* y0 t& H4 k' \' X' B& `
}0 k! d/ P6 p) Q+ V1 o- a/ o( Z. y% N
else if (document.layers){
; P1 u4 j( F @9 l, Ywrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')* t+ v2 [; M5 O* n
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
3 l( x: f% l7 N) g$ gwrite('</ilayer>')
% O/ @! m2 { L( G2 f1 V}; L3 X9 _! q; O5 C. e( e) i# b
document.write('</td></table>')
4 E+ v4 ?! d4 P Z$ m" I) K} ?& d/ x1 L% \" J) F1 e
}8 F3 T) K- t$ T9 F# O% `7 K
</script> |
|