返回列表 发帖

网页之跑马灯文字特效

//修改宽度
9 N! I# O% W* W# Xvar marqueewidth=300
- V4 o' U7 Y8 Z7 g* U1 O+ l+ Q1 f//高度
) U4 H& X! f, e' Lvar marqueeheight=25
9 V+ @6 t3 `3 H5 s1 Z$ y4 P//速度(1-10)9 F' w# _, p" z" J8 Z' r
var marqueespeed=3/ e: G2 R  l# p- H5 j3 K
//背景颜色5 Y6 f1 L, j' G9 w% k* D% E) q9 k. `
var marqueebgcolor="#FFFFFF"
/ R  f; ^! g% |! K% K& Q4 \//是否能暂停 (0=no. 1=yes)?
" O3 H& }9 d8 Kvar pauseit=1% l4 H. m3 s- V0 L

2 L/ k" S# w2 I) m//修改显示内容. @& m, V; X" @9 T
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
! Z9 k5 J1 A) n% `3 T: ^
$ A+ A3 p# o8 o) Z7 K0 e' R# X% Q/ y% O! I$ D( [- }& L( B* ?0 Y* \
////下面不需改变////////////
. P. T3 M# P5 a4 d* `' |  }, [& m) y6 x% W- C
var copyspeed=marqueespeed& K3 V% f' _: u9 z) t" L0 @
var pausespeed=(pauseit==0)? copyspeed: 0* o. G7 G' \& t7 [$ B# p- M
var iedom=document.all||document.getElementById
2 d( V* \- f& rif (iedom)7 V9 \( j+ z, o" }4 X. Q
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
3 v8 e/ k. X  k0 }6 e9 y8 Svar actualwidth=''
0 u% J( `1 {$ Svar cross_marquee, ns_marquee
2 w* |' [; m$ U, y, z5 I+ Y$ @' s7 u; j0 M" D6 A; H
function populate(){+ p, R" f2 E3 }9 x7 y1 L+ Y; \: B
if (iedom){
) _5 ^& u6 @  W5 {1 Wcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee3 U# W6 x" v7 j
cross_marquee.style.left=marqueewidth+82 s- Y' x; E' X' w, h' Z. j
cross_marquee.innerHTML=marqueecontent- H6 R* j; }( Z; V5 h: A( j
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
8 f" I6 O* y: ?. @" B2 s}
( L$ H; e) u) V# D. _else if (document.layers){
* N/ T9 i7 w6 fns_marquee=document.ns_marquee.document.ns_marquee2
, Z1 r) t( g+ |) r6 Fns_marquee.left=marqueewidth+8: t* y. ]- ^$ a4 D1 ~/ C) c
ns_marquee.document.write(marqueecontent)! p) V- ~8 B* j. u1 U/ F
ns_marquee.document.close()$ _  Z" ?2 C2 M4 G7 m, L4 t
actualwidth=ns_marquee.document.width% ^; H. P( u% ]8 c( \; z* Q8 p" X
}0 r2 j" _# G9 |' v  m
lefttime=setInterval("scrollmarquee()",20). b1 |* ^8 f: d/ g$ R
}4 [  j1 L" x) z2 H. P$ [8 V: S
window.onload=populate5 @- R+ y) F4 c. k
& T1 W8 v: G, _+ V0 [
function scrollmarquee(){
" d  w5 P& c' F6 E* c, ^if (iedom){
2 ^4 J+ N  j4 j9 Y6 jif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))' m3 W: o# F+ t7 E7 H2 C
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
5 k" I' N, D8 v% w+ \' X0 c$ Welse
( U! R  X2 }' h5 gcross_marquee.style.left=marqueewidth+8
# j2 d9 V% {# U, {0 b4 q3 L6 z& @5 p( r2 q0 C: ^% u7 J* N! }
}
+ }8 T/ Q- A9 l/ H( Celse if (document.layers){0 ^" w6 }  B1 w* k. v' {' g9 l
if (ns_marquee.left>(actualwidth*(-1)+8))7 b. r/ }/ {+ m( P4 X+ x
ns_marquee.left-=copyspeed
6 U9 P7 I, x8 r- B+ C% B% w5 eelse
1 Y* d: N/ x/ p/ k/ Rns_marquee.left=marqueewidth+8
* \7 s; o, O2 `/ J2 t: ]: i! `  O}' y- S! z, Z. j. q' @
}9 m. k9 p% T% \+ G; G
  F* C1 ?! K; H! e* T/ h8 X7 y
if (iedom||document.layers){$ R) y/ Q' e; H
with (document){0 z2 r8 g& m$ R) e/ F4 j! s
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
+ r) S7 g$ M. e6 [" s$ tif (iedom){
. r0 \2 C- ?' A/ P1 Owrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')2 ]. q7 R0 v* X# ?& M+ l; f7 _
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
4 g6 @, k3 `/ B$ kwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
" h* O2 F+ |/ n; t8 [! zwrite('</div>')& O5 m4 m4 ~' f2 X! q! {0 s, ?( F
}
4 V# U5 e; v. [  E& k/ }& melse if (document.layers){
% Y* [1 y2 d# D0 q. twrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')3 I5 R" k1 W5 k( ]
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')  `2 s  T' O/ ]3 S5 g- c# p
write('</ilayer>')' I. r  f! T5 Z; b
}, _5 U( X  q% Y( W
document.write('</td></table>'), w, z6 C7 v0 t! U) n0 e; n
}2 W  h' b/ j! x  X2 v0 e
}% T' R# N% Y" U$ P6 E3 [$ Q
</script>

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