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

|
网页之跑马灯文字特效
//修改宽度
8 v. p7 Z# e* dvar marqueewidth=300
/ |; q' C! d+ w% d W3 T6 J! X: X( }0 x//高度8 I5 D t- S/ V: Y
var marqueeheight=25# m) x( d1 A& l' J
//速度(1-10). `% o' [& v% c8 l6 c/ H
var marqueespeed=3
3 F/ o0 M: I; ?# N o3 P//背景颜色: J6 j' I+ m, q. W' a% y
var marqueebgcolor="#FFFFFF"2 J) o6 j* a$ q7 { o- X
//是否能暂停 (0=no. 1=yes)?) n! u: M+ x' F7 j
var pauseit=1- S, Y! ~- A# O
/ z: s. @/ U8 Q9 s0 ^1 ~0 h" d
//修改显示内容$ I, g' L) J1 g9 P; x
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
* l* z* J* g9 d+ q! b. r( o6 K
2 V1 }7 B& [0 f# O
6 U# R- t" t0 ~/ ]& h////下面不需改变////////////
5 H$ M& L( l! X6 S4 F. @8 G) R+ J6 F* Y
var copyspeed=marqueespeed* s( s! ?7 I/ V* w+ B
var pausespeed=(pauseit==0)? copyspeed: 0
% g. [: S ~2 g0 E7 t& \var iedom=document.all||document.getElementById2 P% Y) c1 R: d$ E( F: @
if (iedom)8 R+ r0 O" S7 _1 g5 Y7 c( c' ^
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')9 _) G R" Y- w; o5 A/ R& L, u
var actualwidth=''
1 e1 I+ U$ @5 K) M8 J+ ]var cross_marquee, ns_marquee
( u# H. L q, U- N4 t3 {3 n! k9 k h. ]% b* X, K
function populate(){
. Z2 X" X7 m# x& D# dif (iedom){
# N7 I, a& f0 Y# S2 |cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee; i6 f$ f! ^+ f: n5 V0 D
cross_marquee.style.left=marqueewidth+8$ |1 J$ s: d, [5 Q! A
cross_marquee.innerHTML=marqueecontent- I( f, S7 s8 S# ^/ W7 @; U7 v. ^
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
& N0 g8 w+ r5 n0 t; D1 {}
K# Z! i4 L1 F! y3 I* Gelse if (document.layers){
. P! h" k% g: h9 C0 Vns_marquee=document.ns_marquee.document.ns_marquee2
2 K! _7 o4 C% r7 Q' `ns_marquee.left=marqueewidth+80 K0 i* I1 e" [" u5 h- X/ }
ns_marquee.document.write(marqueecontent)- x3 ^" X+ [/ q9 i- y: h
ns_marquee.document.close()
- I) Y% |; s# aactualwidth=ns_marquee.document.width
# ?/ Z+ G7 |: C1 {! I) \}
1 Z: y1 n4 i( l+ slefttime=setInterval("scrollmarquee()",20)' l0 k( z+ {2 v. O! t; X
}
" c1 V1 R( O8 l" Y# W3 mwindow.onload=populate
8 c* [7 k8 K8 G5 V- ^5 t
: [% j- m' E/ u! ]1 c7 H* H5 r4 ufunction scrollmarquee(){/ _; I# k% s$ s. C( P
if (iedom){( M# k) ^; u* s+ x/ H% P
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)) ~! _$ @+ V7 |$ x% |
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed' o9 ?) _# P4 h8 ?
else' L5 z! a! H& d
cross_marquee.style.left=marqueewidth+8* y) |6 K8 R$ `3 W
. {$ k& M; M: m}( l) t' i8 a8 H
else if (document.layers){) Q9 c: I) o6 b. f
if (ns_marquee.left>(actualwidth*(-1)+8))7 G0 E% T$ h' p6 o. |6 S
ns_marquee.left-=copyspeed
7 u% ]* |4 ]2 T; i5 a% B3 R/ welse
0 z! l4 X& g7 E8 T; n- H9 j# m1 Cns_marquee.left=marqueewidth+8
3 h7 p# D# \" U}
( V5 m% E' e" {$ e$ {3 N; J}3 l9 F; C$ c0 I2 L; m0 J/ T
3 |4 j/ S3 |3 a b& t- Z* lif (iedom||document.layers){# q+ y8 W+ i4 U7 m
with (document){8 w ~3 U( s$ e& v! |& f6 w* W+ w
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
' m$ J* q8 P1 {/ ^if (iedom){
3 n. s r% d' m. ~4 |( X: Rwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')5 f. s3 E0 M, \9 u0 V
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
! u3 G9 Y! O) Owrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')1 f3 `6 N6 C+ r6 w6 k! ?
write('</div>')0 _* d: f9 W( b" l1 o- q8 s" z
}
) D* y) S/ X' Z, {# p- y% c/ gelse if (document.layers){
1 ?$ Y( c4 F1 R8 ]/ n2 Wwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')2 D1 |, C! i; z6 T$ `! @; \. s. B' K
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')' r: y ~; N7 f, o" j) m7 g0 \$ j: }, a
write('</ilayer>')
* r& S; ]% [( K( t+ e, e}
2 Y' P; q( p8 j# z3 hdocument.write('</td></table>')4 _8 F3 S( ~# l' l$ ]; ` x5 U* n
}
9 W5 a8 U7 V: u' j5 l6 e& q} @( W" T8 r) c _5 c
</script> |
|