返回列表 发帖

网页之跑马灯文字特效

//修改宽度
! ~' z" `" S% w" z# xvar marqueewidth=300' \& g2 `' q. I7 m; n
//高度( ?# z3 h  ~3 `/ k5 X
var marqueeheight=25+ x' X7 S! `9 i) B
//速度(1-10)
1 }" k. _3 \# c& R) h# u: zvar marqueespeed=3. y) ?8 |" t0 e1 i& Z# C* y
//背景颜色0 y% S4 s' t& x  A% e
var marqueebgcolor="#FFFFFF"
- b' T' c# _( v' B//是否能暂停 (0=no. 1=yes)?
/ `1 ]1 O' |; g/ @( e. ~var pauseit=1
. o( Q1 Q: P( u* X, t; Y; E
: \" B4 P2 Z- q, j0 R: p! Q% e9 u//修改显示内容
4 X5 H- D. T4 _9 g6 X, jvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'" l: Y0 D' U& e4 P6 r. p

$ V+ T, O. i0 P: u! z
5 z! k2 O( V# I0 E- w3 W3 B////下面不需改变////////////$ ~/ i  u2 ]4 z5 P7 l" u
, z. r1 a  ~: {( Y$ D. u6 d( H6 Y
var copyspeed=marqueespeed" a- ?3 k1 @  J
var pausespeed=(pauseit==0)? copyspeed: 0  C! U6 X1 D4 V1 u! w$ B. ?5 T+ S
var iedom=document.all||document.getElementById1 P. n: K! a7 w# `' W
if (iedom)3 }6 U, d3 \0 m- u6 ^
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')4 o/ x( R8 r/ _' Y! L. X
var actualwidth=''
! D2 b% W: n7 {: }& n% y" W; _var cross_marquee, ns_marquee
$ a) C: h. p6 c' }' }& R1 n7 c$ _+ P
function populate(){
3 f( `; q; l0 ?if (iedom){
! y  D* _% m% b9 B; X7 q2 O5 _cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee' W0 D! E, [" y4 @" L
cross_marquee.style.left=marqueewidth+8) B; t5 ^/ P; w7 n1 x$ @' i
cross_marquee.innerHTML=marqueecontent
3 g: `$ O: o- q" s4 w1 B- ~9 Zactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth3 S( V7 x# u4 A0 [% `5 q
}$ U7 k; ?. y2 x
else if (document.layers){& r. a( {( {& o7 Z6 O8 U/ L
ns_marquee=document.ns_marquee.document.ns_marquee20 R$ j% ^% _2 _2 K! b. S
ns_marquee.left=marqueewidth+8
( h( U: }2 A) m, `- \( X* V6 Wns_marquee.document.write(marqueecontent), C& o2 v# [! Q# y3 ^( o+ E
ns_marquee.document.close()
9 J  k0 S9 D/ |; J7 r+ A5 P3 qactualwidth=ns_marquee.document.width
* W5 T: L$ o7 t; e}
% T2 y3 I, `8 c5 ^6 S1 _+ k, n( blefttime=setInterval("scrollmarquee()",20)! `; i" G- O4 u: q% Z$ x8 {* Z* K
}
( I2 ^5 S* Y$ |% w2 O$ Xwindow.onload=populate
& U, v* f) r3 K& p6 @5 R
( M4 Y+ K/ z( d+ ?9 X0 y4 [9 Qfunction scrollmarquee(){
; t- |6 j+ q% }$ i1 b+ z/ c2 O7 p% d( n, vif (iedom){
7 C; r& }. z+ [' Kif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))8 i# k8 p' n' @( G
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed9 ~7 a  P0 N/ F5 s) p+ K* T: D/ u
else
( E- [+ f9 ~; s+ g$ M  B$ C! lcross_marquee.style.left=marqueewidth+8
8 R$ ?: s* j+ Y9 O; Z% s+ x* \3 W; X7 q) r0 j
}1 ~6 O4 N5 A9 u: P7 r# Y
else if (document.layers){
2 P5 V9 A+ Z8 c/ f' \if (ns_marquee.left>(actualwidth*(-1)+8))
# B+ y* t9 {2 m. N3 A0 F: p$ Qns_marquee.left-=copyspeed" j+ [# w0 I) I6 y8 f$ ^& L
else: F% ~8 e7 j; Y1 Q4 {
ns_marquee.left=marqueewidth+8- i) R8 P/ ]5 e
}4 A  n  I8 \4 x7 F7 o
}# w# b) `: K; o! q' _! o: r, p
3 k. e* [2 d" U: A) c/ o7 S! V8 g
if (iedom||document.layers){  O; o7 g* l  h7 f
with (document){  m5 t! P5 u9 o0 x/ D( z0 m
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
0 K6 A) F( D' g) S5 B# M- T" Hif (iedom){2 K+ [( H6 S8 j' T* ?: ^& R8 g9 Z
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')5 Z. M8 v# J/ c% _& O- u
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
5 g! Z3 C" H/ `+ s( e5 X8 Iwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
* r, y2 n: d% ]+ o3 d! S' v& Swrite('</div>')
; S/ n6 R# t5 q$ |$ a5 _* E7 a}2 V7 k' o) {; f. B5 m! m; @
else if (document.layers){
1 L9 r7 Z: N# i; Pwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'), v: M/ d7 V' l& s
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')0 \5 c9 H6 a/ b$ B. s% F3 j
write('</ilayer>')
/ g( K- _- K0 y; o, I+ [}
2 A) }$ r- i0 c# r; S' X7 Qdocument.write('</td></table>')+ `9 U/ u9 G1 ~; q* J# }
}
) r# t; e& P5 h% ~& K7 B}
: W8 {5 _& I) x</script>

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