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

|
网页之跑马灯文字特效
//修改宽度
8 m+ a2 q7 g4 Dvar marqueewidth=300
- h# N; m( {+ u, ~! I//高度7 O- E* a. }2 k
var marqueeheight=254 A& K9 y$ f1 n* j: A( i
//速度(1-10)' C$ r6 Y. g! v% v
var marqueespeed=33 r: A0 Y* O2 C0 r" {
//背景颜色
) p* u; Q, Q- Evar marqueebgcolor="#FFFFFF", g/ K) A" d. a" n* k7 T& W6 w
//是否能暂停 (0=no. 1=yes)?
6 B; Z- P; l. d* Hvar pauseit=1* F: A0 x* j3 E7 L
7 ~0 @7 M) X( Q- m1 O! @
//修改显示内容
- V. V2 R7 G6 E7 vvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
: A1 G& H2 U6 l6 J
% a e8 ~7 S) K& R: ~, R0 | l6 V6 ? _) B4 B( Z: c+ K
////下面不需改变////////////
1 P/ I% i9 j2 ]! V9 g6 _, {9 K6 w- L6 y
var copyspeed=marqueespeed
1 ~) d& j3 ^$ w8 R% |5 z8 N. a. z Y$ Xvar pausespeed=(pauseit==0)? copyspeed: 0, w" w# B9 R: n. B, M( H" Q
var iedom=document.all||document.getElementById# J2 V& {' ^- r4 A# |6 V9 W
if (iedom)6 _" o/ `+ \9 ?0 H* A
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')/ L5 j0 \/ ]- c. G
var actualwidth=''
1 U9 U8 f8 }' T. P! nvar cross_marquee, ns_marquee8 B+ w# w8 b$ R, O
" P! x7 R2 m8 [* Zfunction populate(){
: I/ ]/ t, g$ z6 G' c: mif (iedom){% _, [0 H4 `6 @7 q6 m0 H0 v
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee$ G$ t1 a/ g" d3 X: F* a# u3 b4 Z
cross_marquee.style.left=marqueewidth+8; z9 T1 b0 S( c7 H# W, }0 u+ ?
cross_marquee.innerHTML=marqueecontent+ L) Q( K) j& s( A1 D7 `! u; p
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth. h1 h- i' j& V+ d
}
/ e4 Z* k! p' M1 Celse if (document.layers){5 \& K. u+ F6 j0 Z# Z0 y
ns_marquee=document.ns_marquee.document.ns_marquee2
, T- ~; ~3 L c% c/ ^! X0 X& `ns_marquee.left=marqueewidth+8
) E M: ?9 o1 B5 D0 f1 r% D* ]ns_marquee.document.write(marqueecontent)6 f$ m* S8 K; ? T) U" @
ns_marquee.document.close()* L- K5 n" N& R' o
actualwidth=ns_marquee.document.width
$ F& B. \7 ^$ Y% U}. i6 Q2 J& R4 H) B2 t! P
lefttime=setInterval("scrollmarquee()",20)
- j2 q* I; g- N/ K% L R}5 a. ~( f. c9 Y# V. t
window.onload=populate. A& j8 _4 P; ^* X: Z* ]5 Q
6 v/ u8 F$ z7 @7 F
function scrollmarquee(){# ~, [2 v% L% b8 A
if (iedom){
/ e. X2 S; `1 }/ J: Dif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))1 b$ L, C$ f* M6 D) _7 g
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed6 ~9 `1 B3 X! I
else$ o+ J: V* Y. D; p8 U2 m; z) L( T
cross_marquee.style.left=marqueewidth+8
; a- C1 r% Z G# N6 c& ]* Q* u3 v, [5 N' b) J
}$ |+ N, j+ r* k' z/ O1 F. c
else if (document.layers){
/ `; V0 i# s9 Eif (ns_marquee.left>(actualwidth*(-1)+8))
& M/ D8 ?6 V6 [7 V$ T- [ Jns_marquee.left-=copyspeed! g6 t* }( m0 t
else
6 W2 D m) n" F$ W" ~ns_marquee.left=marqueewidth+8! F+ r* t- u( W4 t9 z+ h; L8 D& k
}2 |) T: c/ d0 g1 ^! L; a+ H* z: [. X
}% N* {2 {$ s* ?( i) i3 @) E+ ~2 y3 G
9 @1 H0 i" H4 g% |& A! eif (iedom||document.layers){' _: ?; b! z) P& U0 a
with (document){5 |$ T5 t# {& S* G% B+ A* r8 }
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
$ P6 }6 S! Y+ ^if (iedom){
: i* p; E) O1 F5 V6 w6 W, ^5 i7 owrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'). a! k3 {# j: S' i
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
$ J, [- r- Z4 I t- J1 s3 |write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')5 A4 v( e. e* k5 }3 n' H" x
write('</div>')
G7 w1 Y$ H# e! J" ~ n: n}" c6 X% j# S1 @* g. i! Y" t
else if (document.layers){
/ J$ ?5 H* `% W+ g( N5 c Twrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')9 o6 W- Y# z5 ~# ]
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
' n1 y0 T& t# s1 M) q+ D( V9 ]write('</ilayer>')
" V! z& o- ?3 z) X( h/ ~}+ o: y4 v# L8 Y- q
document.write('</td></table>')
1 j; T7 _; ]; T5 Q6 q2 W$ V}
: `( z4 E7 D$ M& k}' g" x# ~4 L- o6 Z; ?
</script> |
|