获得本站免费赞助空间请点这里
返回列表 发帖

网页之跑马灯文字特效

//修改宽度
# J  s4 q) O, a( rvar marqueewidth=3007 O/ J2 G! W' t( {
//高度% H7 D0 w! }+ N% X" r
var marqueeheight=25
% X5 D: p6 I5 W8 y8 ?; Q/ Q//速度(1-10)
% x. P  K4 \. Tvar marqueespeed=3' E8 b3 ^) d9 Y$ U& L
//背景颜色
0 |: @$ e; t" V5 R* evar marqueebgcolor="#FFFFFF"1 `3 ~+ E  j. R4 \* u
//是否能暂停 (0=no. 1=yes)?# g: `# b% x/ U' G
var pauseit=1. O- F* j$ t0 G9 ^' f  p1 j

! o" {1 P4 c# p1 v/ V% x, R7 d# u//修改显示内容
7 T! T% Q8 ?1 l  F# \5 x+ [var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'; k# ~6 o$ S4 P7 F8 Z( B7 k( S
3 a; `: U$ X0 _8 r
; y( g" W( x% s0 j  g. `
////下面不需改变////////////6 A5 R9 l) c  i' t! e  D$ Q  v
+ w4 ^9 s- d& m5 [: C& n+ l
var copyspeed=marqueespeed
9 i, b4 e3 @) `2 S- S/ {var pausespeed=(pauseit==0)? copyspeed: 07 E- I) q/ U/ ^5 x
var iedom=document.all||document.getElementById% l  t$ Q- P4 w0 P+ F# w
if (iedom)' R* ^$ g7 [8 B% s
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')$ ?0 S0 k, `! ?7 e; V& `. {& V" v
var actualwidth=''0 h. O/ b5 j# \$ E. z$ k0 D
var cross_marquee, ns_marquee2 {, g- a: @$ M. r2 s* Z2 D
* q4 F5 ~4 k6 z" ~, s3 p
function populate(){
$ K9 f1 r+ I9 k2 {3 H# F/ A: Aif (iedom){
. V: w3 {! f0 Ccross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee$ q3 h2 e1 \& H/ ^+ X5 s" F0 n
cross_marquee.style.left=marqueewidth+8
; R- G5 D) E0 M. y+ ncross_marquee.innerHTML=marqueecontent
$ j2 \" l, Y5 S" y8 W# ]6 V! Eactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
/ R. v2 e4 g& ]  Z9 b( B  B}
8 i) h( M% ~( y, U* Gelse if (document.layers){, t; X7 w* M6 f
ns_marquee=document.ns_marquee.document.ns_marquee2( i5 V( ~" C0 Y' [% H7 N
ns_marquee.left=marqueewidth+8
% t4 m0 i9 _% J4 Ons_marquee.document.write(marqueecontent)5 @2 h+ z9 a5 ~. ]
ns_marquee.document.close()" l2 Y" p% Q9 Z& o4 w' ?) U
actualwidth=ns_marquee.document.width
. S  j( ?' U3 n) y8 [5 x8 K}
2 U) h$ i& A, F3 s# h+ Rlefttime=setInterval("scrollmarquee()",20)6 j& Z$ X3 \" a( A' V( Z
}$ d, p. G1 V7 c
window.onload=populate
% p+ o4 N2 ~& V  S* O& X$ }
4 q& m# J8 q* e* [% j  Ufunction scrollmarquee(){
9 o: Q+ \# f% j' D# t7 x" l- Aif (iedom){  R; ]9 p. }7 C% |
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))+ f8 l8 W- J: x# ~0 X* Z
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
. p( Z/ R2 c4 P* R' q3 B) t& xelse
+ t! R% y  w) \: p1 n2 \4 B  @. M+ a$ Dcross_marquee.style.left=marqueewidth+8$ ~, \$ ]) I; v! f7 d, Z- ]

- z8 M, K2 w. g0 u}& j5 x7 F* a( S6 q% A3 t% Y$ Q
else if (document.layers){
2 R6 B% L; X4 `: z" o7 C( d& dif (ns_marquee.left>(actualwidth*(-1)+8))+ }" d9 r, ~0 O6 c
ns_marquee.left-=copyspeed
& J" T+ g$ u8 u7 Melse% b2 w4 R6 F, E( j, d9 X
ns_marquee.left=marqueewidth+8
3 [" f, O: J9 Z8 P}
9 t. l5 _0 [! W* w: _}" f, u* w" M% O7 |- D4 R& x
1 n: g- {' U0 A, C$ |: o- `
if (iedom||document.layers){
7 D. R& J; i& S, e* gwith (document){
$ }' n/ l! c) adocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
6 E2 J: C' I3 m0 t0 b/ e4 nif (iedom){
' P7 p2 E. v  ?- E0 T4 X( `3 o, Cwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
* H0 f+ |% i2 x6 C' R) Lwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')- \6 O$ e4 e) T' `* R" ^! C% f
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
  ~6 E* ^* G8 r& W# m9 }* i) P! Nwrite('</div>')$ ^& A# b7 n  [
}* W) K' x- K4 B# t
else if (document.layers){
4 Z( Z0 K1 Q" V& h7 |7 Vwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
: Q% c5 q4 `$ M* i& _write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')- i/ r$ Z2 G& {+ f5 j- I$ i. ~
write('</ilayer>'), x/ [& \; w  Z% k5 e% _
}5 b% e/ k  s8 p1 }6 c2 ~" I& N
document.write('</td></table>')
' ~8 S& x2 w' X: i' I}5 ]# n+ c/ B- c5 U+ |. @
}
; U% y% A! h% S' y3 b) p</script>

返回列表
【捌玖网络】已经运行: