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

|
网页之跑马灯文字特效
//修改宽度
6 P7 m Y4 K2 s+ Xvar marqueewidth=300" H+ w/ O0 k- L4 ]! R
//高度6 Z* S4 a. C- N4 D3 j. M
var marqueeheight=259 o% o0 E$ V$ `: a, }
//速度(1-10)
# O: V" P4 C: h; K/ Y$ g, ]# Mvar marqueespeed=3
* ^# H$ O, t7 z$ Q! G. V+ N//背景颜色
4 |9 q9 z' U" @5 _var marqueebgcolor="#FFFFFF"; w4 E# L! U7 x& K
//是否能暂停 (0=no. 1=yes)?
7 Q2 ]5 u- t2 I. H5 bvar pauseit=1; }; k& q z& J0 T7 ]0 ~. l
$ [) @' P* s7 P
//修改显示内容
6 r! Z, d( Z1 U& m! Evar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'2 {' M5 ?1 ~6 \0 ^
- t3 y- m: \9 W% r
3 w* Z; X1 j8 h- }* l////下面不需改变////////////5 L* e) G" w1 f, m
5 y, F" N g( y5 ^$ L8 Bvar copyspeed=marqueespeed/ I# J/ u: o3 l0 V" v" X4 B
var pausespeed=(pauseit==0)? copyspeed: 0
4 P' H1 P- I) G3 N n- M+ |var iedom=document.all||document.getElementById
1 g9 P& _/ K+ J1 V V# r2 Gif (iedom)% V c: p! j4 P
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
( O {3 q, a1 L* s. N" Y. Jvar actualwidth=''# Y2 z3 m/ e# o/ q" Q0 G# K8 P
var cross_marquee, ns_marquee
5 y, F2 y* z# C' i" }7 `! i8 D7 x) T" z; Y3 C2 a9 K2 {6 O! \5 n
function populate(){! D" u; b' Z( @# B2 e
if (iedom){
' r- n! F/ a% D, c, t2 icross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee5 l9 @# w7 q- } |, I$ ?. q! D
cross_marquee.style.left=marqueewidth+87 A1 O- E: f# S- |$ p
cross_marquee.innerHTML=marqueecontent
0 @7 A4 M% B. S# ]! Hactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
8 H; v) u3 ]( i7 q4 k}% V% F! t; z. o- |2 `
else if (document.layers){1 F* ~/ g' ]1 G4 @7 g( u9 k+ w
ns_marquee=document.ns_marquee.document.ns_marquee2
( V) p: [. l% }& [/ Ens_marquee.left=marqueewidth+8
5 m! w5 f% Y0 ?8 q: t. Hns_marquee.document.write(marqueecontent)
: m, Z" t& Z- |. g4 n/ Q! s! [ns_marquee.document.close()- S4 @% D; K6 c! E+ V9 z% h
actualwidth=ns_marquee.document.width, L& ~! X+ l5 [4 a
}2 u2 Q1 X m; \2 p% {$ h( }
lefttime=setInterval("scrollmarquee()",20)" u/ e, x4 b% M. E4 B' A" Z7 f- K m
}% z4 \" C8 G9 X' r6 Q/ f2 K
window.onload=populate
+ j, C" O4 j3 W3 g" |: @3 \/ s5 n; l, Z* X, C& H! r0 B) z7 X
function scrollmarquee(){/ _$ V# w) `: Q$ t: d
if (iedom){5 Z0 |# L" U$ ?
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))+ ? c4 |" R2 L' n
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed Q! ]0 h; O' T( @
else$ [7 _, f6 [8 s4 z) G
cross_marquee.style.left=marqueewidth+86 x1 a4 U& _% W
9 j, A. K5 Z+ s
}
9 m! N' A9 t& u2 Q& Z; L- U. k s- a, Qelse if (document.layers){; M8 P3 `# p1 z, C Z( J
if (ns_marquee.left>(actualwidth*(-1)+8))
# }8 X0 B+ j) y; {4 _& Z0 Tns_marquee.left-=copyspeed( E% u% Z8 J( Z+ Y$ n
else
# Q9 h* G! @1 v0 x# f% Gns_marquee.left=marqueewidth+8
0 w3 R2 v+ {* \0 O6 k y9 ]' I}
7 i3 w3 w* s2 \3 ~9 N* L9 I8 \}
+ g, B0 T/ ]+ Y. T, e0 C1 w
* d4 F& l) h% l V! T! G% p; uif (iedom||document.layers){- [; H7 e- ]# z1 {9 f% s
with (document){0 l$ o1 }& x* f9 w' b
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')/ ?0 Q, R' A% w
if (iedom){
0 p6 w( n9 [+ w$ K1 Vwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
* Z7 {4 ~4 z6 R: v* k# C0 Ewrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')5 J3 N2 m) b1 }
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'); P( P: n7 k4 o/ V6 d
write('</div>')
: m4 W2 l' A7 V- t}
, E4 I+ n8 M2 ?& R! zelse if (document.layers){! Z7 p. v. O5 a* L. z
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
; y, e- \; K* twrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
z( r0 l) y/ h" N1 i" qwrite('</ilayer>'), @3 l+ @$ y' i2 O. r1 @+ u& C
}
4 z# r% g* e7 L- n" V$ I2 m1 cdocument.write('</td></table>')2 R6 `$ c! y/ v7 U/ M
}
; ]' W) _$ _$ O: c+ G% e5 X}
8 o% ]# b. ?/ h. C</script> |
|