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

网页之跑马灯文字特效

//修改宽度, p, v9 q% l6 F" W9 c
var marqueewidth=300
# |# h9 G7 M3 a/ S% a4 A$ H' k- S: d//高度7 g% A* k# W1 }' Z& ?
var marqueeheight=25
) n  [& |+ y; D3 i$ V5 v- {//速度(1-10)
1 V% P( G1 J4 Z  k$ E' w+ evar marqueespeed=3
* s- j. D: l7 ?//背景颜色
/ u. @2 F6 L! r6 }. j. C' j. kvar marqueebgcolor="#FFFFFF"9 V1 s: o; z8 l/ e# o! R0 Z7 t
//是否能暂停 (0=no. 1=yes)?7 V* S8 [: f: |
var pauseit=10 h6 Z% i2 M  I5 W7 r  a, u

: i1 U# v# N$ z+ e, ]- b& w/ m# Y//修改显示内容9 i. t6 T  r6 k8 _9 \1 i" f+ l
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
; g( R0 j8 z1 Y3 k: t$ f  }/ r( _& {# E

# K4 q& m" K, L////下面不需改变////////////! H/ B% U9 X0 {  U& w  K

$ ^! U6 R/ F3 O% J9 H' R! Gvar copyspeed=marqueespeed
3 a4 o; ]. F* s# E! U7 l/ ~! _var pausespeed=(pauseit==0)? copyspeed: 0
( o# ]% a5 c* b. i: X1 T* jvar iedom=document.all||document.getElementById; A7 D& z# a3 y; E+ r+ H
if (iedom)6 f. i  Z0 X" s! L
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')$ c) g! W5 Y2 ~+ p/ V% A2 B- s
var actualwidth=''
3 b) ?4 f9 a: Mvar cross_marquee, ns_marquee
% E7 F- D( n" A* p" V+ N
% ?5 n- p' d7 i4 ?& Ffunction populate(){  N: D* ]9 [) w3 L. @1 A' l( w0 J
if (iedom){# D, k2 ]+ I5 A* ^1 w6 Z
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
- \" q  X2 g( R) P8 x* Q; K4 |' x5 rcross_marquee.style.left=marqueewidth+8  X, y9 t2 }) [% D
cross_marquee.innerHTML=marqueecontent
% y* O, @9 C1 Q8 lactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
4 w" H, Q5 {6 g! G: q4 I+ P8 Q}
" I! y. N1 k( g* M! Y+ nelse if (document.layers){' I1 G) U+ b. ]  u- W. e/ N
ns_marquee=document.ns_marquee.document.ns_marquee2& A$ }! e- o- S, L- S% U/ z" y# g: b; V
ns_marquee.left=marqueewidth+8  c4 z  A2 k, I2 W3 H1 E
ns_marquee.document.write(marqueecontent)" |/ D6 v1 `# u9 r
ns_marquee.document.close()
4 l0 C3 Q- N* e8 S  `* U. Iactualwidth=ns_marquee.document.width9 `! [! q1 M) Y' e8 R; y
}( |; L- E( z: B) E
lefttime=setInterval("scrollmarquee()",20)
1 T- o, F3 ^$ l" f# @}
* [+ X( H3 V  L# Y4 R) lwindow.onload=populate3 k7 e1 F; X6 s  B8 m0 L

, J9 K  v1 ]" U% ^1 i/ S  o1 I9 Ffunction scrollmarquee(){1 J. v/ ~9 B  ?8 e: l
if (iedom){' u' I* w! Z6 I4 v
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))3 s  \2 j( `* G; A" K
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed* J% @5 m3 }  i+ D
else
' f5 n/ [6 O# {5 W% `+ P4 [cross_marquee.style.left=marqueewidth+84 \- b2 G' [5 X" K" v$ ^* Y
: A; f9 m5 Q( o$ J1 ^
}( f( M/ v: y" o& ?  K/ e- w
else if (document.layers){
6 U* ^, o/ z. t& `. U; V" M7 D' Bif (ns_marquee.left>(actualwidth*(-1)+8))8 |) w& d: V6 p; j0 ]2 z, D
ns_marquee.left-=copyspeed# c) @% T. J* A$ v( F4 E* o! j0 v1 k
else- P! ^, u- H; |
ns_marquee.left=marqueewidth+8
& b9 U3 _" U( U" s1 Y, j}( U7 D2 _  w: v3 m# S8 G2 B7 n, h
}* i7 z9 ^# ?8 J+ m; @( V" D7 C+ x
- D/ X. D" E0 B
if (iedom||document.layers){5 t* v1 S- k. _: [/ t  I/ X: G& F
with (document){
' \: K4 R% _- [2 qdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')0 n; ~- x% G1 _  K
if (iedom){
+ n: I: w3 H$ e" v% H* Vwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
) }' G6 O0 I  J$ `9 D9 K3 {write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
8 r% l/ n! b) j6 W% [) Qwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')  u* N4 l( Q6 d" G0 d' z
write('</div>'): q% d: x0 Y5 y8 j6 V8 g/ R
}5 S- ^- Q7 ~/ A6 G% X$ y7 R  w
else if (document.layers){* P( O$ {# r: M* O1 ~
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
) ?' u& U1 f0 N# w# \: R: T8 ?write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
# `0 n1 }7 F+ p7 b8 E; zwrite('</ilayer>')
5 p$ f2 _$ G4 r8 W4 u}
; ^3 j, v+ I! S3 }; `, K5 Wdocument.write('</td></table>')
% ?6 M5 p; U" r  `5 M% n5 \}. [8 X3 |' d& W3 U1 X
}
1 t! b* I: c; E7 Q$ l! ?8 t3 C/ x</script>

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