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

网页之跑马灯文字特效

//修改宽度
' }: x% ]% B& e' P8 @8 z. @var marqueewidth=3004 a# A9 T* U# C% t5 A7 p
//高度3 b% h0 V( B! c$ N1 W' L
var marqueeheight=25
7 t. u6 s- Y% @! I- U) o8 J3 z# c//速度(1-10)1 I+ V, Q0 `, F7 j) Y8 d# K
var marqueespeed=3
( q! I+ M) g, N) o4 O4 E//背景颜色) H4 t$ ^9 V5 c! s4 C) ]
var marqueebgcolor="#FFFFFF"
3 w* s5 C6 ?/ c; O//是否能暂停 (0=no. 1=yes)?
. ?9 Q# O; [! Q! p9 [var pauseit=10 n" b. h# O! M+ J
3 H! b6 ^8 g$ n9 g7 F( e
//修改显示内容- w0 X$ }7 s1 N  ?8 u' T
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'+ T5 @! e+ @0 W" a8 x

1 `7 X2 m! l/ ~$ v( n# F6 T1 I3 [% y
////下面不需改变////////////
$ G/ o, c1 C: w/ c3 Y8 v9 |$ J* j% W/ J+ f7 Y
var copyspeed=marqueespeed/ v- }7 x' L: @' k) r5 F
var pausespeed=(pauseit==0)? copyspeed: 00 k+ U' r. g5 O& o2 ^: b' R
var iedom=document.all||document.getElementById
4 ^3 j. [" e# i$ g! I/ [' M8 o8 |if (iedom)  [2 c5 u9 u' E$ x: o, p6 L
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
- g$ q! b2 m8 ^4 P& B! _7 }  svar actualwidth=''- o) s0 r& S# I
var cross_marquee, ns_marquee  L" v! X  e0 p4 w" F8 y8 w
! l7 ^% r: `+ L: k% q
function populate(){
! n) r2 i( L  b2 ]% `1 |if (iedom){
+ {' v# W* ?1 t/ Z* f' T, A0 ocross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
% ]9 w' s4 Z. O, F9 h3 F' O+ ycross_marquee.style.left=marqueewidth+8
; e' r6 y5 I8 u2 `2 Ecross_marquee.innerHTML=marqueecontent
) b0 ~) b) x' N+ N. H$ |actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth# e9 \0 y- }3 N/ D' Q8 @4 A, K
}
  F5 U% \. F5 P' l& J% welse if (document.layers){3 x8 O# ~1 M4 [* P3 n( G
ns_marquee=document.ns_marquee.document.ns_marquee2; m8 b3 I- y7 D0 [" `- d
ns_marquee.left=marqueewidth+86 Z) U0 N4 c" p+ y( Q$ n1 ^
ns_marquee.document.write(marqueecontent)" L7 V1 _4 {& W8 p
ns_marquee.document.close()  d) }% ~, A6 K
actualwidth=ns_marquee.document.width
) Y/ U! r# T8 A0 m" q}3 t+ f1 l4 T" ]1 A3 p- L5 W: I
lefttime=setInterval("scrollmarquee()",20)9 Z: ^  c* `+ Z5 m
}
9 C1 r. j) t5 Z% a- h) Z; Y, Gwindow.onload=populate
, T' h/ J& r) D& b. L& _7 t" B8 x; P2 I- Q$ K$ y$ T! a7 r
function scrollmarquee(){
/ Q/ {8 b$ m$ l7 {" X2 t+ _if (iedom){, Y7 K, M0 u6 A  D8 O4 H3 u1 w9 ]
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))3 e2 U+ [5 K) L6 S; e7 O
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
. S) J/ S4 }, K' \4 t6 k  V( y( i- kelse
; S; p+ v+ W2 F" M) h+ }  N% dcross_marquee.style.left=marqueewidth+8
# t, U; R9 [+ ^! q5 J8 `* E3 M6 D( Q
}6 _5 ?- p+ B& U4 q2 j
else if (document.layers){1 I, M" U9 v. i2 _2 i- t5 ]8 R
if (ns_marquee.left>(actualwidth*(-1)+8)); d% h, }+ g; \4 a# R; W2 p
ns_marquee.left-=copyspeed2 S8 V2 x  D3 }
else; c. g* D: L# k2 K- x; i1 O9 I
ns_marquee.left=marqueewidth+8
3 E" D) P) D) q8 }. l6 Y/ p% p, ~}* s: n4 J: v* Q& g+ x" B7 m
}
) V% k# R$ T; i
6 H8 i8 W1 |  K8 }. [if (iedom||document.layers){/ Y0 [* `1 s7 Y! e9 \2 G
with (document){3 ]9 i. J8 y0 A1 k1 s' i+ ^" L/ u0 V/ H0 @% j
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
9 S6 J( K1 U3 ?9 u9 Qif (iedom){
8 m% w( C, u+ D# t9 xwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')+ ]0 {. }0 q+ r! K- T# ]) z
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')1 p3 Y  ]7 c2 g# p8 v
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')1 y( t$ v8 m# f+ L3 G$ E
write('</div>')
( p6 X. \0 q+ y7 s}
) s2 j0 F' o& R, U" w. yelse if (document.layers){
  |- ]2 i  l9 l1 Y# s+ V, b6 iwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
7 D' m0 `( V4 Q$ B( |write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')- s& T0 q- G9 T! _
write('</ilayer>')
9 o( [9 n, u# e}
  c3 M' a& q* H. [# p; Cdocument.write('</td></table>')' v) c# U- ~& E) H' a: ?/ ]. k
}
6 x' m+ ?6 P8 H}; @6 n: Z/ J: h  {7 Z4 b
</script>

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