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

|
网页之跑马灯文字特效
//修改宽度
. t, a$ @3 b" n3 ^ {7 ~ fvar marqueewidth=300
) P, ]" ] |0 h& I4 G: y5 v2 T//高度: m9 @+ w+ ~5 b9 ? u/ i# L
var marqueeheight=25* s* {+ M: m7 s* F3 C% M
//速度(1-10)
% {& q2 D& M4 ?5 \var marqueespeed=3
/ I# Y8 P4 y# }2 G1 Z//背景颜色
/ D" p- c# a. a& S0 Z; Bvar marqueebgcolor="#FFFFFF"7 w f6 Q2 y* z; O0 v
//是否能暂停 (0=no. 1=yes)?9 U7 f. ?0 B- U# p& R
var pauseit=1' [6 j2 b7 o8 A
# }4 @ w3 i J, A9 o" q
//修改显示内容
7 N* \1 S+ [1 i! S2 C& Rvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>' t$ U( v9 g. m2 q& A1 b' j
% n- L5 n0 n6 ^ w6 I+ ?
7 q' W) D. N& ^; u- k////下面不需改变////////////: Y% S- m" F/ n' o5 x
' F4 Q% o! E) W4 T( o% Q$ L. pvar copyspeed=marqueespeed% d+ c1 K9 y2 O7 ~3 C
var pausespeed=(pauseit==0)? copyspeed: 0* q8 j6 ?$ i/ W: l! c- N
var iedom=document.all||document.getElementById
+ e8 F# O5 D& F# }$ bif (iedom): P- a. J; ]' \# q( b% q) F
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>') h' |2 d) x& U: ~. w) X/ ]
var actualwidth=''/ ^/ D% @7 X% x. ?) ^. _3 l
var cross_marquee, ns_marquee
0 M2 g* [2 T& U: w8 W
7 `8 }$ ?: _$ z: a- P" a. hfunction populate(){3 Y1 |3 k; H' J1 M2 ~9 d! c" J
if (iedom){" [* Z# r6 @0 P/ ^4 K% `3 U- a
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee; m: i( x& a1 o" ?. n1 }
cross_marquee.style.left=marqueewidth+8/ a- A2 X& T/ K" D- k
cross_marquee.innerHTML=marqueecontent0 _( F8 _* h. t5 x; G4 G
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
$ s. l& [. s: m# n0 ]" |) O7 ^; M: p}
% Q! X6 h% W1 Y9 j6 O6 `5 Welse if (document.layers){: o: O* U+ }5 x
ns_marquee=document.ns_marquee.document.ns_marquee29 T: A+ r# _, G# Z4 }- [2 U
ns_marquee.left=marqueewidth+8
( Z7 l) O7 R* s1 Hns_marquee.document.write(marqueecontent)
U# M8 B# A2 H) a3 v6 V& |; w8 yns_marquee.document.close()
( C( T) _' p ?. M. I1 s; Yactualwidth=ns_marquee.document.width
! Y0 O( {* T% c2 c+ b8 n}
* h& v; y1 v8 R# H [7 _lefttime=setInterval("scrollmarquee()",20): ?2 I+ A# n' _. W& ?2 [. n9 O X
}3 L6 n' ^+ h, L8 ~- c" i
window.onload=populate. Q5 t, ]" u$ ~; M* Q! W
& [% x0 C: n4 _' w
function scrollmarquee(){: r3 _: j( t$ S9 S' w% o& G7 J1 b
if (iedom){
/ V- S0 L i' Sif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
- B4 @# M, {# q6 ecross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
5 V2 g/ }& E5 v& c2 felse
9 c7 H; H# x9 s! r7 Hcross_marquee.style.left=marqueewidth+8" Y: G4 }* T8 ~/ n
2 S& E' ]& B. d1 q. f# q% L0 P. q}1 s) P" T+ D7 c) b0 o1 c* X! p
else if (document.layers){
3 u4 A- W* B6 L1 w+ C0 G4 J; v8 uif (ns_marquee.left>(actualwidth*(-1)+8)). a( h A( O' F! Q4 q' G
ns_marquee.left-=copyspeed
0 I% B5 G( H; \2 oelse _3 d, y3 I8 _9 L. D8 n4 \
ns_marquee.left=marqueewidth+8
; ~4 O& s' I# Q- p+ m P$ r}
8 L' h1 ^, r! _8 B5 y}- z7 E& A& {* q: V" N$ g H
- T$ g: q% s. _& x3 |* b6 ~if (iedom||document.layers){5 R- A% c7 U! Q% ^) ?- Q- w. u
with (document){5 }9 |6 X3 x- t
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
: J2 k7 U8 |8 r6 \, r8 S# sif (iedom){
/ v/ R' l5 u$ Fwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')* o- z: [2 t; ?- c: w
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
" {+ l, ?# @' V7 [) e2 Lwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')# e3 {& @3 z; W4 ~
write('</div>')9 }, l6 u0 I" x/ h
}
9 m( P9 ^$ u* O9 z' C- n X( Felse if (document.layers){
) L3 z" ~/ |# l- @( ~* g' xwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
+ p1 l4 s' H7 h5 F, owrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')" {" n2 l% m, f5 T
write('</ilayer>')
# s! u0 I) B$ D}& f, r ?: x5 J7 Q& i- `' U
document.write('</td></table>')
: c1 K* ]& K4 z) F}4 t& G% V5 u' H- L: b6 d
}
* A, Z0 R) m. B/ K$ R$ h$ M% F</script> |
|