获得本站免费赞助空间请点这里
返回列表 发帖

网页之跑马灯文字特效

//修改宽度
0 J6 S* j$ t3 o' m' e) Dvar marqueewidth=3002 s2 X0 }/ Z5 L" T7 Q8 H* {
//高度
. z0 ?6 l, |* T6 |var marqueeheight=25: r& h% E2 a8 U
//速度(1-10)
0 c# u. t" v1 L$ u7 tvar marqueespeed=3$ T5 a) ]" B4 u7 A5 e0 X( v
//背景颜色5 x: S' S) H5 e4 w7 ~; ?5 z6 u
var marqueebgcolor="#FFFFFF"
  g- n( K1 Z9 q//是否能暂停 (0=no. 1=yes)?7 U' V5 V2 L( U
var pauseit=1: |1 A3 M$ f! ~. h& d, m6 |0 H$ p* m( h
( g+ z' X( u9 ]$ w
//修改显示内容
' D/ L. n2 z% z1 D4 r' ]' avar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>', Z2 c2 w" h: Y/ h% h( k3 _
" ?7 E; x/ U; }

/ ~7 H7 y1 q0 f////下面不需改变////////////
6 a3 j- \2 t- ]5 C. S- h4 ]# X* M/ M# W  v4 l$ g, a
var copyspeed=marqueespeed
6 _5 l, J% r0 D; `) [  U# @var pausespeed=(pauseit==0)? copyspeed: 04 T0 I8 B* s0 q, S$ r# L
var iedom=document.all||document.getElementById
; \6 a; D, f4 B7 E9 x/ k5 n( L% kif (iedom)
9 O$ g/ E5 z2 ~" edocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
& H9 o6 A1 u+ Q$ `4 Y0 V3 y/ Nvar actualwidth='') a+ R! t# q" g* G
var cross_marquee, ns_marquee
+ h) X7 L' }1 s: k9 e' G: x" z, m
  K: d- e* U& f3 ]9 V: Xfunction populate(){
- \& h  p* P% C3 u0 o: a5 I. Gif (iedom){
. Z! r8 N+ q5 x2 l! V6 Qcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee- ~$ O+ n' q: A7 r, {
cross_marquee.style.left=marqueewidth+81 G. Q# {' ]; X! y! N) g+ v
cross_marquee.innerHTML=marqueecontent8 b: [  X% [( P3 T
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
+ l4 B. [2 M) h; u4 j}+ R7 e5 ]4 V  N3 [7 x, J& c
else if (document.layers){' z- z8 L2 F3 q1 @
ns_marquee=document.ns_marquee.document.ns_marquee2
3 }2 o7 Y; r2 A& A7 {ns_marquee.left=marqueewidth+8
1 [; f: y* Y3 v6 ~* A3 w  Xns_marquee.document.write(marqueecontent). \5 h! K- \9 l- J" u
ns_marquee.document.close()
5 ?, Q- F: [, i- Lactualwidth=ns_marquee.document.width
) k- [6 X7 d4 f$ ^}
; j2 G4 G! p  f7 f1 f# {. i9 Qlefttime=setInterval("scrollmarquee()",20)
1 n1 F! F9 B- L7 [% e# t}8 w$ {8 ^% D! C, j& n
window.onload=populate
* {. j0 s( g$ Q6 e( [0 S2 K! Z2 A5 n9 {
function scrollmarquee(){
1 g: A0 y0 }* m* tif (iedom){
2 h1 b8 H3 K" E+ z1 l! Hif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
1 F" |& s8 n( W8 Z  |cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
9 z1 h. U$ z- `4 n2 d2 ?else" ^( Q1 X6 N4 ?- p8 A( k: W
cross_marquee.style.left=marqueewidth+8. G+ K7 l' q& g4 {
2 z' C6 m1 l9 X) m# k$ G7 Q2 z. P
}
+ a* V! C; _$ f3 M' t* ]* t7 s6 relse if (document.layers){: f2 V  ^" h+ H# u% L
if (ns_marquee.left>(actualwidth*(-1)+8))
5 c& W& r' r- o) Sns_marquee.left-=copyspeed
: _; W+ {/ b% s6 E5 Q5 Velse
; B1 J( A# Q2 o6 Zns_marquee.left=marqueewidth+8
7 h% N" E/ ~) j8 Z}
3 M7 A4 u' R% o' q1 |5 G3 j}
, }$ Y( Y/ t" U3 m; v
3 c; m( q* c8 V; Z' M" U% Lif (iedom||document.layers){
( _  g  g5 ^9 pwith (document){
  Z1 b' L- z' P3 W: a& Zdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
4 C  E/ r: B4 e. B# Pif (iedom){
' R: o$ s& d, ?" ^2 X6 y7 x, d- j) Zwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')$ D6 f! o6 e# D4 y
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
( s/ Z, t2 N$ \3 a" Dwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
9 m" |+ ^( `/ l) Iwrite('</div>')
9 }7 L% b3 C! k}
# S% T# N. q- N9 b4 |else if (document.layers){: K4 F* ~& E) U- Q9 t* o+ \( p+ }
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
5 s; P5 y+ I" M+ x1 \2 Qwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
( I7 M* g" K: N% N4 H; f2 b  Fwrite('</ilayer>')# a  b$ j. y3 ^9 s1 _$ B
}: @0 Q5 N3 a1 r. o+ Z
document.write('</td></table>')" j' o* t4 s& x; b
}
1 h1 k" o& @) R6 ~}  B, ]$ F$ i/ N% s& j  Z9 D* J
</script>

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