返回列表 发帖

网页之跑马灯文字特效

//修改宽度" `, n! ]. A: X) S3 U; m; N/ @
var marqueewidth=3003 ^. q/ O  W7 H! T' {+ T& E+ D
//高度( G# z  }- t# S2 K; X
var marqueeheight=25, N. ^6 G% ^1 b. d. v3 K
//速度(1-10)' K. w  p3 c+ e, i6 C3 e' G. k# X
var marqueespeed=3, P- d5 t& k" \1 }7 G; O) n
//背景颜色
$ Z$ n8 v8 H, c+ [: {4 ?var marqueebgcolor="#FFFFFF"; p9 s% w! y9 d. \5 N
//是否能暂停 (0=no. 1=yes)?
3 j* n( b9 t* B( x3 B$ m% m; xvar pauseit=1
! N& ^6 p: E, k, C: _, c: a" k/ _) H) @. G. U1 \
//修改显示内容
2 @. W5 Y" T# k# z) [0 w+ a0 Y& Mvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'6 q+ C5 J- p7 {6 G  J  L& W; u
( J! O/ G( A7 c% w* I

+ I. F4 v& K% F4 {. A////下面不需改变////////////5 t' w+ u' g0 T1 b) M9 e

4 ^9 C$ W# Q- t) t& j( |var copyspeed=marqueespeed$ b, r+ D; W- S4 e
var pausespeed=(pauseit==0)? copyspeed: 0  c1 z. {/ d4 a
var iedom=document.all||document.getElementById
- Z! u7 f  J0 G0 S5 m1 M+ d; Vif (iedom)
- Q- h7 i& B0 W" K( \3 ~document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
6 L9 E7 [8 N% e' |5 W  n, ?4 |var actualwidth=''
" b" Q4 M2 [1 C& k, I6 D, uvar cross_marquee, ns_marquee+ P# U1 l8 ?" J5 ^( ~+ E7 g" F4 k
+ _4 p; D# o) A: {$ ^
function populate(){
' u" ]& U9 B, b& m+ g: mif (iedom){
, B$ ]9 f) B# e8 c. h+ Zcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee- D" E% o) N& n" e9 p
cross_marquee.style.left=marqueewidth+8
; b5 f6 [6 {- N4 m' i3 C, E) fcross_marquee.innerHTML=marqueecontent. \: @$ }+ a6 M9 a
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth  R2 N7 P' N( I/ [; G5 w7 @
}, P/ y, n% [& o' x
else if (document.layers){7 m/ T) Z7 j, O7 o9 t, {
ns_marquee=document.ns_marquee.document.ns_marquee2
4 i( }7 [% t. @7 T, h3 D0 Xns_marquee.left=marqueewidth+83 E! E$ b8 I! w6 Y! u9 T# V& `
ns_marquee.document.write(marqueecontent), s3 V$ O7 w, ^! }, D4 u
ns_marquee.document.close()% m! J9 L1 F0 z
actualwidth=ns_marquee.document.width3 J! r( A0 y8 D4 p8 Q
}
+ q% t" D2 @1 J" e# _lefttime=setInterval("scrollmarquee()",20)
2 r1 a' A5 ]& y- G}0 p) w. f! N8 ]6 D$ c7 L4 e
window.onload=populate* J* D; N6 e" N4 Z
2 p+ y! Z/ H" i9 Z9 S
function scrollmarquee(){
/ t3 b0 {1 o, l4 mif (iedom){% y. u2 p: U% Q/ m7 B: C) P
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))* i% w2 w; q& W4 ~* i5 n
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
: h; a  O+ x. S% R/ Helse- e$ Q$ S1 E0 v, k* _
cross_marquee.style.left=marqueewidth+8% m# s$ [4 I7 X. V) ]+ ~' a7 W

7 b+ L  ~" u! G# j5 z$ a}$ ]# T. Q0 `# F7 a0 T; Y' K4 z3 I% [& T
else if (document.layers){' G4 M( k+ b, {5 [8 p# J
if (ns_marquee.left>(actualwidth*(-1)+8))' `  V, n( {' I- ~& |" Y
ns_marquee.left-=copyspeed
: U3 C- p* t% z2 }else
# u0 Q! H( A; f2 U6 Yns_marquee.left=marqueewidth+8
( q7 B) P1 F, ^4 o5 p. z6 g}
" z+ b/ L. i8 p6 X0 g/ g}- A" m+ ^3 a1 ~; {/ t, q
* d( i. {: C  Z3 g1 ~  j
if (iedom||document.layers){
! u( A" c, {1 M% D$ n4 k- qwith (document){: a! ]( E! O0 n7 o
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
1 L& ~! V( k. z( U5 N, e6 nif (iedom){1 e- Y; ^5 L& z; U8 m
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')8 a3 `! T3 Q; J6 ~2 P7 C" W' D% ^+ D
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
2 L6 W+ }% Y% L6 Q- Bwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
1 t& c/ X( i& s" a! p: l+ p# w8 gwrite('</div>')
+ b( U1 B- w( l8 X  O; |& n}  @' k; s6 W7 w3 r, j
else if (document.layers){& D2 B0 d" q( [
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')/ Y& W& B1 y) R% e
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
/ `1 F- S# H9 y# [! ]  {, m" kwrite('</ilayer>')
- ~! ^3 V9 s. Q1 `) y) B! Q}
/ Y& k! q7 e( y3 I: Y+ b6 mdocument.write('</td></table>')
2 V/ n5 ]# g  f- h5 ?. q}
: D9 u6 x; _5 n0 h}
8 A  ]6 l+ r: M7 }% h6 p+ t0 p5 x6 j</script>

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