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

|
网页之跑马灯文字特效
//修改宽度
! r# x7 ` K* P, O- i4 L- Mvar marqueewidth=300
! r% t4 }0 a& s% R9 y4 e4 K//高度- V4 k& ]/ T4 E9 b
var marqueeheight=25; m/ l7 F5 z+ C
//速度(1-10)
0 H8 m/ r' O" r" I9 o+ `var marqueespeed=3$ n6 b5 M, k8 p" t
//背景颜色" j! h1 F2 K; j; U7 f- z5 h
var marqueebgcolor="#FFFFFF"
- R- O* \0 D7 h/ `7 O% {4 F2 q//是否能暂停 (0=no. 1=yes)?. F. i) G0 E0 n+ c n% N$ B
var pauseit=1
; S4 ~! O5 q1 C5 c3 O: l1 V8 _* n- K/ s" _' T( E, U+ Z' q
//修改显示内容
) b7 Q/ h8 e/ ^+ @( S tvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
1 J6 U$ J0 n1 U" S! k
9 n! N2 F B: n0 f+ G2 a1 Y2 q, K# Q% c6 l. Z. R& v
////下面不需改变////////////
9 w/ J3 H' {/ M6 z( A0 P
4 P4 V ]/ }6 Z7 q" B; \4 Jvar copyspeed=marqueespeed
9 Q: m/ H$ W$ B" P# Pvar pausespeed=(pauseit==0)? copyspeed: 0
4 Y6 I3 B! W4 {( x0 j$ X$ xvar iedom=document.all||document.getElementById+ a% g! C! `$ z g9 y
if (iedom)5 c5 A$ b4 V* y4 A; q
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
, [% k& g6 E4 M3 O8 [var actualwidth=''" b! _6 p7 t6 C& ]1 V7 B, r
var cross_marquee, ns_marquee5 {. U. g: N7 ?! u
* } N9 l* Y" R! F% F
function populate(){
@6 ^5 e1 Z: m1 Hif (iedom){# I, `# l( f# F3 P
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
k2 S0 u) w* Q0 m8 s: Ncross_marquee.style.left=marqueewidth+8) x+ f, d; k5 W) U' k M
cross_marquee.innerHTML=marqueecontent
) B j$ H L/ {! q, K* W7 aactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth+ F* l, W _7 N$ h, h
}6 s4 m/ t4 z: c8 _4 i o
else if (document.layers){% l5 K, O8 b# v v
ns_marquee=document.ns_marquee.document.ns_marquee2" ^: ?- n( Q% w# P! r8 Z o
ns_marquee.left=marqueewidth+8
. }) f/ p3 f8 A: C8 sns_marquee.document.write(marqueecontent)
$ ~, @6 b/ b Ons_marquee.document.close()
. }7 K X; ]7 g) ` j' v/ wactualwidth=ns_marquee.document.width
6 c- R. p0 t1 c}
: O) y6 Q4 x) A, M# F" c7 plefttime=setInterval("scrollmarquee()",20) {. Q8 y8 v: s/ A+ x, U2 p
}. y) E; q4 [- l8 a2 o- r. }
window.onload=populate3 s7 Z& A4 ^0 ~! F
2 U/ Y7 T- l9 K9 X
function scrollmarquee(){
* Y1 d- C- l$ ^6 v6 V% k3 }$ t% {if (iedom){
. _7 R* J$ {8 D1 |- g# U! Mif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))( d* d( p h; [, @
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed" m9 \* \1 n7 ^5 J0 t
else
- e* r$ h; [0 }; b5 ]cross_marquee.style.left=marqueewidth+8" ^2 o) G5 ]! d6 P/ V9 j
) w6 S3 i7 X8 I! b}, V& d* ^/ F% p4 E3 S7 L* a2 P
else if (document.layers){! e9 }5 q0 J& \9 J
if (ns_marquee.left>(actualwidth*(-1)+8))
+ i- \2 G, b" g+ K8 F1 r4 uns_marquee.left-=copyspeed
& X7 h4 x; o: R3 Z7 zelse% h" u: c) x' G- |( O
ns_marquee.left=marqueewidth+85 G8 b+ X5 N6 i5 D7 n$ C5 \1 U, W/ Q
}
# a0 z- x$ q$ [" t9 T8 T5 d}5 s; D( R& v8 K) m, u( N
. L7 m2 o$ t* B% g) G( U# {9 I" Fif (iedom||document.layers){
' n& M& \) l" |with (document){
2 T* \# f+ k, G9 v8 k/ Fdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
/ o7 E. J2 g3 ?; y5 X6 @5 X0 N/ dif (iedom){
) K2 w2 t5 P! H8 ^write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
7 s+ J( X0 q0 W9 X2 h/ Y+ qwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
2 l" D2 H, d6 I, D) d0 |8 z% Swrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
! _) O0 q [) t) N9 ~6 mwrite('</div>')
) w1 l9 ] l. O% M! B: i) A' X$ L4 k}
3 f* ]7 y) m) E& X" _% h6 Ielse if (document.layers){$ L J9 q' C+ X$ j( H: H
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')$ f2 l6 z0 \) s# u+ i t* C
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
2 v: h6 y; v# a) v/ q; \; nwrite('</ilayer>')
" @, B0 D, \9 c4 c: m* f6 s, i* d# ]" z}
2 U- P; B2 v' R, E2 y# I3 Sdocument.write('</td></table>')" g6 u* L6 U7 y/ w+ C
}7 v/ U0 c- c$ m. L1 }, M
}5 D2 y5 a4 n. _
</script> |
|