返回列表 发帖

网页之跑马灯文字特效

//修改宽度
8 n. t$ J( z& {2 `' X5 ~1 U. [; m4 ^var marqueewidth=300
& O8 E' J+ x& _% s//高度
, g" Z- W9 n1 V+ ]var marqueeheight=25- ]* `) p: h& t3 K$ y
//速度(1-10)
+ Y2 m5 l# P6 N  N3 ^' L/ xvar marqueespeed=3
, f$ l& D0 T: g& j( Z//背景颜色, F9 {/ ^( n% Z  p
var marqueebgcolor="#FFFFFF"
5 w3 \9 n% {; g* @4 |//是否能暂停 (0=no. 1=yes)?' K/ F% Z) Z* ~
var pauseit=1" U5 D6 {5 ^: Q' W

. ?; O* z- @" ~4 P//修改显示内容
) c% N4 W- k6 Z) q* T# avar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>': j8 G/ g6 |& v- y' c2 O
. a& c& C3 p: p: _  I- @1 I3 R7 ~  t
& [8 B9 C. K: Z3 d  X6 _& |/ U
////下面不需改变////////////& E5 e/ z, @5 B% U% E  N- s" ]

$ X  b  U( J/ {5 zvar copyspeed=marqueespeed: C7 M9 J8 L' C$ q
var pausespeed=(pauseit==0)? copyspeed: 0# h: d5 B! r: ?. P5 u+ M, K$ E# {
var iedom=document.all||document.getElementById
4 _) h/ R8 c' @8 M* g& bif (iedom)& x9 q2 d: T1 X- m
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')8 ]% I/ K4 \' }) o8 u, \% n
var actualwidth='', R& y) z& U) k( B
var cross_marquee, ns_marquee
- a( V% G5 Z5 n+ V' Y! T) ^/ {3 v* i1 y8 @; S2 ]
function populate(){1 C& ?& n) h5 X: \2 m/ o
if (iedom){
- P& d& O1 L7 g- Jcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
/ a/ M- P3 w! u4 ^5 Gcross_marquee.style.left=marqueewidth+8
* H! g* `& L( y$ D3 Hcross_marquee.innerHTML=marqueecontent+ x# m- S5 P0 n/ `( E
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth+ M+ n" f$ G& I
}. A& T  s0 x- n
else if (document.layers){
# t: l" G, Q6 p2 d3 w+ I" @7 e4 rns_marquee=document.ns_marquee.document.ns_marquee2
, F# y4 T* q$ |- ^ns_marquee.left=marqueewidth+8
1 O5 X2 l/ Y2 f8 g4 k1 Ons_marquee.document.write(marqueecontent)
7 i% s% Y, c' d4 f$ ~& A, B! G! nns_marquee.document.close()% }3 f* s, N/ b  K8 S; j9 k
actualwidth=ns_marquee.document.width
* N, u2 Z, |  Y' P1 b}* X: R% e, h- f. ?+ U
lefttime=setInterval("scrollmarquee()",20)& B$ o, D. v% x0 f9 ?9 d5 F1 Z4 I
}0 q$ A; o- k3 i3 B8 J; p
window.onload=populate; s5 U! [& ?7 @9 _9 v0 P9 B/ a8 B
7 E! z- N! P; ~: M% V# u
function scrollmarquee(){) W+ w. j0 E( O
if (iedom){
) U! r; v- s2 E. W4 |, ]if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
1 g% j: Y) x3 ccross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
. Z" Y) {- s" [3 O" Qelse8 h4 L% X" H7 p1 M; W) |7 S
cross_marquee.style.left=marqueewidth+8
8 D# _: r# F* t4 h( ^9 z
' |, T) ?$ |4 ?' b0 K}
. ^' i; r" E% t0 W1 i% U* r: w, aelse if (document.layers){4 }/ ~3 j  a$ V: R
if (ns_marquee.left>(actualwidth*(-1)+8))% m2 n7 z: }' h
ns_marquee.left-=copyspeed7 s: z1 o, r( y
else! ^( j3 ?  T, P7 P: k) K4 v
ns_marquee.left=marqueewidth+84 X# C, u6 {7 H3 p4 {. K
}9 I0 F  c& J6 F3 A$ d: ^# P
}
$ j6 g; L3 v6 F
) [  G  n; b0 k3 S+ W5 ~' {if (iedom||document.layers){5 E, |5 i& B3 O1 F" R! Z
with (document){
' g1 l- B6 V+ `% M. jdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
" {# V& W! X- }* K7 f# cif (iedom){
! k2 i3 n/ z$ ?: O; \write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
" |! |" L* u1 ]6 z* F+ ^! }write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
8 P# c+ |# O" w5 T# [- {write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
0 ]* F+ V) F/ Y9 z) qwrite('</div>')2 R0 P- C/ U  k+ I  _% L  |
}* |( [& D3 h; r8 d& T
else if (document.layers){
% e/ {+ ?7 e& N( t' W1 z, P. gwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')8 F. X' P! U& V! Y- g
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')5 R  D7 U- v6 m
write('</ilayer>')
5 X% }3 ^. A" ]$ [, |  b0 u}
3 L$ R7 Q* N* k) u, {7 J2 k2 hdocument.write('</td></table>')6 i  B6 u: b; e* y
}
; V, S& j. E3 y) |8 l! o: [; J. J9 P$ e}9 V$ k+ z2 J' V: s8 B/ ]! A* L; e$ S
</script>

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