返回列表 发帖

网页之跑马灯文字特效

//修改宽度
) z! i7 S: P' ?& u' k' @var marqueewidth=3003 a) y! r9 {: }
//高度" @: R9 j# ?6 `$ ?' P( X
var marqueeheight=25
/ \3 Z' k( l1 R8 `0 u/ D, {$ w9 W//速度(1-10)
" K0 G5 P6 F0 o" R8 D3 Tvar marqueespeed=37 ^2 S# T1 s$ a+ a- S& k9 l
//背景颜色  s: f; q0 w9 ]6 z9 K
var marqueebgcolor="#FFFFFF"% r# w  f+ p% Q
//是否能暂停 (0=no. 1=yes)?
5 Y3 q3 ^) W% \0 q5 [var pauseit=1
. U1 _. a+ H+ n6 }1 @+ k1 o( Q' V/ [, G$ l+ L5 Y3 q7 c. s/ ?" m% x( w
//修改显示内容( C) ?# {" F* t; I, h3 v9 i
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
& L) N0 o5 B; K) P6 B* J/ M* [& E. y3 ]7 {( F( E9 _$ U

# |* e" `+ [% P/ {( y* d////下面不需改变////////////
0 a: }9 [, Q- [
  R4 j7 i& G9 c& h7 d. o( {8 `var copyspeed=marqueespeed) R8 a2 I' B0 ^
var pausespeed=(pauseit==0)? copyspeed: 01 z% U# C5 j* ^: g( A
var iedom=document.all||document.getElementById) |, `. [$ M/ L
if (iedom)
1 z; z. {5 K7 B% Z* I8 d4 u0 Edocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
3 H. N. x# m" d$ `# Vvar actualwidth=''4 m# N3 [) b! T. k4 W8 L
var cross_marquee, ns_marquee
+ @) N9 r& C2 a+ p
+ `' O8 K4 b0 q4 S5 e6 a; tfunction populate(){
( p/ p$ h) L8 G5 E9 A; ~8 fif (iedom){
' I# ^0 {& i# G& F7 B4 Vcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
0 h3 a9 E# {3 i" dcross_marquee.style.left=marqueewidth+8( C( n- @% x# `0 a) V* M
cross_marquee.innerHTML=marqueecontent
) Z& ~( V+ A% A4 M  P7 jactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth4 Q2 D# G/ Z6 \' z: r' Q1 A/ n8 @
}6 t# T2 {+ B1 b9 k" ~' g* q
else if (document.layers){
2 e. P% x+ ~5 Kns_marquee=document.ns_marquee.document.ns_marquee2' c4 U, c; N( q- ?6 f
ns_marquee.left=marqueewidth+8
2 v5 l; w& C5 pns_marquee.document.write(marqueecontent)
9 X2 P' o4 b" J( g- Lns_marquee.document.close()( E# f9 B" c( G' V& A* \+ a2 Q) {
actualwidth=ns_marquee.document.width
4 I: _8 o; B8 Z8 c}; {) J2 J- z, n7 S, ]
lefttime=setInterval("scrollmarquee()",20)$ R# ?+ D( n- q
}
$ k' B/ d5 C! Vwindow.onload=populate+ e9 w1 |" p' L' `4 P+ u  _

. y* N. L2 ]) Ofunction scrollmarquee(){1 C/ t+ ]* C5 l6 C- K
if (iedom){6 ]7 M+ i4 I& q( D
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
2 @8 r9 [6 n: V5 R% O+ m5 ocross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed: L7 B* G& S7 H$ l
else
3 k4 v2 F) E/ j6 `cross_marquee.style.left=marqueewidth+8. A$ J# y! |* U

+ p( `6 q6 g, Z, m$ w' V$ b: `}6 G" g  T; M2 ^
else if (document.layers){# `" b0 k: p7 p9 y4 E
if (ns_marquee.left>(actualwidth*(-1)+8))
2 ~# L/ M) k# `) P- P! Hns_marquee.left-=copyspeed
3 h1 k( n/ `2 E: O3 q. S) celse
( e# N0 O# y1 e1 Fns_marquee.left=marqueewidth+8
8 a- V: R9 ]6 G" h, q' W, ^& |}
- F7 K2 x. L0 D0 u5 g# y}
2 Z' H) E7 X% i) T* T4 W! `* {- r: H. t& J+ ?: o
if (iedom||document.layers){! _0 x( a  R8 \$ o
with (document){9 B) |; G$ i8 t' z8 p) t
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')5 W3 G1 a( |9 T( f
if (iedom){0 C! H, U' o7 i/ Y( r0 U( a
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')3 A0 \( c/ y5 l" \4 c( M  b! ]
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')! G+ }$ e4 Q( |3 v
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'), o/ f* z; W4 J; r
write('</div>')1 U8 x* O- q7 Y+ l: w- J0 K5 i  n
}( n. X( ^2 q  W' S. q8 I& v7 U
else if (document.layers){
( P2 k# c1 G/ U6 O2 V; Q& Mwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
, A4 i& u$ _8 z- \& t4 h+ e9 ywrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
2 }5 C7 y! ?' X5 V8 e% }( {write('</ilayer>')7 V$ E0 _- y! B- b7 C+ ~
}9 r4 d$ M# F8 U0 x
document.write('</td></table>')1 x, h7 S. r& G3 Q, [
}1 L* v! \( }/ V5 ~3 H; m  h
}
/ s9 Y( w$ B) H  g( p</script>

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