返回列表 发帖

网页之跑马灯文字特效

//修改宽度
- _1 }% \- G7 G  `! k6 ~/ ]7 w& Bvar marqueewidth=300
$ i; v! ^, \2 A$ ?//高度) `. Q. K  S+ P" t+ A8 h8 O
var marqueeheight=25) P* P/ m; s) R
//速度(1-10)
# B, l; G0 |! Dvar marqueespeed=3
' `- i9 j; M. h2 D//背景颜色* c! B2 e; M) Q& n- z1 e3 ]
var marqueebgcolor="#FFFFFF"1 ~5 w4 _; b( M0 G! o
//是否能暂停 (0=no. 1=yes)?$ Z9 l! ^. {- T1 W1 x5 B2 U
var pauseit=1: k6 A6 m9 l  r. v* l
2 }  R8 o3 x& B0 k& k2 m
//修改显示内容
( X: a- k# \4 @3 ~* i2 v( H& Dvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'3 d/ L+ T5 L5 U. A  @' H

, B4 d: X/ z$ t# X& J; o: p( o2 r/ _; P/ j$ m3 i
////下面不需改变////////////( `! C4 W# w& K# ]; t3 t
0 |; O+ p" c! M; Z& r
var copyspeed=marqueespeed
7 f4 N4 L( ~& x0 [var pausespeed=(pauseit==0)? copyspeed: 0
  j2 |0 w+ Z) ]/ m7 |var iedom=document.all||document.getElementById5 N: }" k8 S% w& I/ K( m" Y
if (iedom)
  ~: d$ f1 p. N9 P+ C4 d. Q' fdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
/ l& }0 n( R& Pvar actualwidth=''
/ d# A( U7 b3 f9 s6 Z0 wvar cross_marquee, ns_marquee( D7 O7 Z0 a8 u
  N7 o; z+ m( s, H/ P& I
function populate(){
7 s1 D0 K8 P3 a6 qif (iedom){
: n0 P- E- g6 Y4 ~cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
; t% B7 O. ]$ H! p( Ncross_marquee.style.left=marqueewidth+8+ `( f0 t/ G; O9 F+ A
cross_marquee.innerHTML=marqueecontent/ z# J; U' s8 b8 R) d, @1 R9 x
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth' Z* r& f" v( q$ `% K5 `% Y7 Z8 I
}& d- u; N1 J$ C- Z+ g
else if (document.layers){2 I7 A& z  F1 v+ S: g$ p
ns_marquee=document.ns_marquee.document.ns_marquee2
( H2 G* n# _/ \2 N) Gns_marquee.left=marqueewidth+8
8 J. S6 h8 j! N) @( _2 z' mns_marquee.document.write(marqueecontent)- W" @' i0 |: ^# X0 }
ns_marquee.document.close()% M( J3 {2 ^/ O- I; \4 p+ u
actualwidth=ns_marquee.document.width# Q1 Y* L2 O; @8 i1 H
}
. K7 J" ^. S1 [7 Xlefttime=setInterval("scrollmarquee()",20)9 s5 j+ A& ?* |6 }; ]/ K2 y! O
}
9 J' k3 M  [- E/ mwindow.onload=populate- `) J& D& @3 n2 _

- Q% C( P2 _* f0 _function scrollmarquee(){, f; s8 O% i. ]' ?8 F" G# R
if (iedom){' A! s9 `3 M; I2 N
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))$ X% w1 a3 D7 l* t) I
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
, ^2 D: q( Q2 J! L+ t: Celse2 }: l* G0 H5 S8 b9 \: t
cross_marquee.style.left=marqueewidth+83 k" ~$ V; {4 X9 \
# H& d; l8 j' x! K3 U+ m4 [
}
) A( Q: k9 J$ G$ B, Z7 belse if (document.layers){3 _4 K9 C7 N. E8 R
if (ns_marquee.left>(actualwidth*(-1)+8))
8 W- H% h6 y! ]6 q. E5 H) ]' [ns_marquee.left-=copyspeed7 E7 L3 U% G6 Y3 z3 T* W
else2 {8 A! ?9 p, k9 s- f
ns_marquee.left=marqueewidth+83 s/ z6 ^' r9 }; q) e. E
}
, _9 P$ U4 z. Q8 S) }}; D/ n+ D9 i: Q9 j4 {' `

- T; I( M6 L/ N0 yif (iedom||document.layers){/ q9 x% U% P3 D- k" k
with (document){1 i8 x! O! ^& J4 ?& q2 t
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
1 S9 ?" d! V2 f, d$ A  [if (iedom){/ g6 t8 k# n. e& g1 J
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
' }4 R5 }2 h' ~# {write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')# m& j7 ?' R1 z/ o
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'); t: G' a' D$ ^
write('</div>')
9 x$ P# U2 x# O/ |( C}- }) R- u& c5 C4 X# z  e" c
else if (document.layers){
6 L0 l% P) x- M% E7 {write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')% t7 M; E& s7 m
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')& \& T; k! n* E$ y  t( k
write('</ilayer>')( n# Z& {+ Q3 j
}
+ l- B9 t- M6 o# V+ O" Hdocument.write('</td></table>')5 f' B) _; U" D4 j! t. E; K
}
7 z. T1 b2 Z$ w" a}
0 B) R% R5 T: P4 ^% I1 B' U1 v</script>

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