返回列表 发帖

网页之跑马灯文字特效

//修改宽度5 d* G* G# I  j, X9 o. T
var marqueewidth=300
; U( y7 @3 T$ [5 ^: _- H//高度
  `! D; Q; B" M2 e3 d1 w9 f( Yvar marqueeheight=25
2 A; H3 S5 B1 B$ @: ~//速度(1-10)
3 b' i4 T3 `: X% L9 v# kvar marqueespeed=3
7 O- {/ q- b8 w' A4 ]//背景颜色
0 y! o+ i- Z, F5 j7 @4 f. _var marqueebgcolor="#FFFFFF"
4 A1 i# K" P: p: ^4 i( `& n//是否能暂停 (0=no. 1=yes)?
; f& I! S5 U& d! mvar pauseit=1" v: Q/ M" `* s7 d1 N  p' v, |
5 o6 u- c$ ]5 F  e
//修改显示内容! b. ^3 w  W( Y/ Y7 L
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
; b4 I) i3 U' b/ B
% ?! ]0 D% g+ N& x$ V( S1 a* Y/ A( y  ]
////下面不需改变////////////8 B) b4 B# A' Q/ M

" x; I& Z% I4 n, j) ]) A" avar copyspeed=marqueespeed+ V9 a* M* K; a: L- N# F
var pausespeed=(pauseit==0)? copyspeed: 0% E/ k9 c+ k5 V" S( n$ W8 b
var iedom=document.all||document.getElementById
9 M4 |; X  Y! B1 u: k8 P* B; Vif (iedom)5 Q7 Q6 Y$ e' A! ?& v
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')4 \% w  Z2 W9 j& a  i* i- p4 `
var actualwidth=''
+ J) ^8 v+ Z. V8 svar cross_marquee, ns_marquee
" p  p% t2 F) t1 s# R
# j& I# L# s2 L1 r8 s# H" k* Ofunction populate(){! _6 H' [$ A4 c& r; z$ n
if (iedom){* V4 T" z8 r) v9 Q5 c# V+ I% U
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee! ^( w2 W% b- f) r: N: ~
cross_marquee.style.left=marqueewidth+8! O" O+ l! t7 T; h1 ?
cross_marquee.innerHTML=marqueecontent
7 C! v' h' f  B$ A2 tactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
2 a; \  w: v% j}
9 \0 X+ t4 Z4 q; \. r5 Telse if (document.layers){1 r; A6 m: d* c1 Q1 P
ns_marquee=document.ns_marquee.document.ns_marquee2
- i5 X% K% T% p/ T4 ~5 O# Pns_marquee.left=marqueewidth+8- _6 B! U4 N' Y: Y; P1 X. Y2 B
ns_marquee.document.write(marqueecontent)
$ W& n* r2 M0 j- Tns_marquee.document.close()
: _5 e8 K1 e" r1 d3 _9 e: `actualwidth=ns_marquee.document.width* @5 K; m& B( E' }
}' d! S* A6 n( ?% _4 I) J' r
lefttime=setInterval("scrollmarquee()",20)7 q0 y" U* \& w) F* N- ^9 s0 j
}$ k6 D# O8 s% i4 P" q! E3 S) Z
window.onload=populate& Z1 u9 ~# v9 X% F8 x
( |' i5 `0 I7 Y! v# W
function scrollmarquee(){4 k5 ?% K4 \- g& @8 h
if (iedom){
+ }! G- y3 X/ j! J' g, h7 q: Aif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))5 P  \4 p& f  A% Z, H
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+ k0 H! i; h  w" t$ C1 h" q1 ^
else
1 L& h4 ]/ |( jcross_marquee.style.left=marqueewidth+8& g( r. ]) j  N7 T: e( v

9 h% Z- H: D( {" K) F' ?! t}
% J; M* X0 c5 t! X5 E" \else if (document.layers){
' ~8 e$ n8 [) h! Y1 Xif (ns_marquee.left>(actualwidth*(-1)+8))
- c3 }; T7 u1 K6 B  Uns_marquee.left-=copyspeed
. Y- G& A% ?' d2 |+ `+ A. Kelse/ z. }( A) A, _
ns_marquee.left=marqueewidth+8. r2 \5 d; S) q9 d
}8 g" K0 U- H8 Y
}
) N4 j2 E  n9 H* x# O5 T! o& _9 t/ i3 V
if (iedom||document.layers){
" o! I: a5 J! C& ~  kwith (document){
: r, I( O: Z) i( j! w% udocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'). ^" {9 o3 a+ G$ z1 _7 i
if (iedom){* `& `0 f" z6 z
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')% H0 T! j0 l7 a- p  N' z
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
8 b) W9 A# ?( Z( Nwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')4 U" ^  m0 a* j" m5 f1 L% J
write('</div>')5 S9 a+ F) r3 B2 t8 x
}. Z; y+ h+ e2 v
else if (document.layers){% H1 J7 P' B( N$ J6 i9 ^/ Q
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
- Y0 ~) c/ V4 f0 {5 i0 Nwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
- B+ t) g; e0 V* @5 c- Wwrite('</ilayer>')0 D1 h$ J+ h8 ~7 m
}- |, ~) q) a! r9 |1 |8 B, q
document.write('</td></table>')1 f0 ~+ E. d9 Z8 e  z4 G+ B7 F
}5 ^; Z) I, R0 M$ Y) f+ q
}7 E& l1 e; O! n& @% E8 X
</script>

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