|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度" S6 P n5 c8 q) o& Q! N1 H
var marqueewidth=3000 {" s. Q5 ^" g7 ] r/ e
//高度
! |# L! p8 k2 T0 yvar marqueeheight=25( e7 Q: m! x3 `3 Y
//速度(1-10)
8 K w& H! G2 ~& x1 Rvar marqueespeed=3
& D7 P5 }2 C& t//背景颜色) j. |7 g3 k# k% V$ n
var marqueebgcolor="#FFFFFF"1 K8 i% _5 F4 R* A2 e8 \
//是否能暂停 (0=no. 1=yes)?7 A/ Z+ E4 z0 E8 S: @; T
var pauseit=1
# n* U: P7 Q/ B( g: x
. V9 U0 J) S0 }/ U: y; f! S# L//修改显示内容8 g7 n2 ]( n; r/ D+ B; r
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
, b- p( } F% u% ]( e! U. i+ f$ {9 k+ \# i
( Q" H$ Q1 L9 E4 z////下面不需改变////////////+ a1 e6 C3 d8 J6 W# t
' d: U) `) b1 O) L; w
var copyspeed=marqueespeed
; N5 ]; l' F% Vvar pausespeed=(pauseit==0)? copyspeed: 0 [: k1 N5 Q7 ^
var iedom=document.all||document.getElementById2 X3 }8 ~' f( Y9 F+ S4 N8 N! d
if (iedom)
5 j' U; P! p1 d) ^+ v0 e/ ^5 \document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
3 b1 x* R& y6 u" pvar actualwidth='') r/ ^; D! C5 O
var cross_marquee, ns_marquee
* {0 X. l) M" `+ h8 ]$ ]
- V# B, ^8 T) t* F& y/ E) Tfunction populate(){8 j4 t# p9 ]. o2 T$ ^. K
if (iedom){/ g5 `5 Z$ ^- {) t, y
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
$ H, a4 v0 C, p- dcross_marquee.style.left=marqueewidth+83 B1 c, e, O1 p! p, d0 P" U( V
cross_marquee.innerHTML=marqueecontent
# b- \& M* N9 A9 ?* Vactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
, s8 b* [6 |3 A1 v& b# |}4 B5 Y# U, d' @7 D9 f- `3 m! e
else if (document.layers){( \, {8 I: b: ]6 W! N* L9 l( V
ns_marquee=document.ns_marquee.document.ns_marquee2$ U6 E& c% w$ @9 h# s* V/ P% z
ns_marquee.left=marqueewidth+8; @( l1 C* E/ G% M
ns_marquee.document.write(marqueecontent), @* G" Y' N( o, U& z( w# M! y
ns_marquee.document.close()0 E$ W$ v8 a$ X3 Q5 N7 O+ q. V
actualwidth=ns_marquee.document.width7 d( ~: x3 b8 ?: I8 ?! {) w, |
}6 X1 P) ^' R' H4 s, m' n( T
lefttime=setInterval("scrollmarquee()",20)
' i+ m4 E- _- C# d% d, W$ B# o5 L}3 Y& D7 F' C8 e+ {0 w/ X5 f# M @& G
window.onload=populate+ m- Y# n$ W' P$ d* ~
9 [9 y# R5 R) c- ], a2 k g- [
function scrollmarquee(){
' O: m6 G0 Q% o8 lif (iedom){" i* p0 G+ j9 s" h
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
: S0 t/ x* j4 R) @cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
6 [% f3 m3 F$ ^- ~; C! w8 Celse/ }' F+ n2 H. l3 P5 P# m
cross_marquee.style.left=marqueewidth+8) ~$ r7 b4 D' ?, h1 P' B4 K+ U
G) u7 n% R- a9 B- L" D}% h& W. K' @$ T+ J$ k
else if (document.layers){$ Q i: X) ~% N6 ^1 y
if (ns_marquee.left>(actualwidth*(-1)+8))
% q [# }5 |+ v- {. |* lns_marquee.left-=copyspeed
5 R# M- m; U) C) Selse2 |+ l X/ ~1 X+ ^. r0 w
ns_marquee.left=marqueewidth+86 Z5 c4 o9 l( A7 ] g2 E" V: u
}. b; J* r$ l2 L
}
# y) f. M& j, o
( p% X M, ]+ w6 D, q t8 w: q% Sif (iedom||document.layers){
; K$ X# s- b$ l1 m0 r2 Awith (document){; I ?& R; ^. \' A
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
7 w8 {2 r; \* R% |if (iedom){; s+ ~% Y' _. w6 C
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'); o* U% S% N2 t$ _9 `; U" X
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
' T* X. u: V- z8 V4 N' Twrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
6 f& d! W1 `2 G/ X/ o0 Cwrite('</div>')
$ R( N/ V7 c5 g) {5 F}4 b+ ^& e; k, z+ c8 U: l
else if (document.layers){$ }' p0 g Q' {" o: r
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')) L. R) U! K0 H' h1 ^
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
* y6 {3 C( r$ J7 J/ n' Awrite('</ilayer>')8 s1 s; P9 E, N6 F2 R
}+ A" D' @8 q3 z% m K
document.write('</td></table>')
* F6 a0 z" S! \! V# f4 Z4 q' a: w}
% w( y. a z' i+ U! L}0 S: J9 i% D8 I0 Y- F( M" B
</script> |
|