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

|
网页之跑马灯文字特效
//修改宽度0 u" m4 L. @7 T5 B# W( X6 O: m1 h
var marqueewidth=300
6 u4 F0 [5 K5 ]5 A3 Z! q5 s//高度
; k7 G% l: ^$ ~3 ^ @5 Lvar marqueeheight=25
$ w5 g3 i8 K+ P7 h t0 y8 z//速度(1-10)" D1 W& z/ s8 d: W/ T
var marqueespeed=3
2 y9 y; \ \; r' i9 G//背景颜色/ `# V# s; s* Q2 { V: t" M3 c
var marqueebgcolor="#FFFFFF"
1 V/ H9 I; F, J3 C- v! Q! J//是否能暂停 (0=no. 1=yes)?% c) }! q: J3 M
var pauseit=18 z4 Q: K2 e9 b/ g& W
3 @$ \/ }* j' r
//修改显示内容/ c4 u% ?( V0 g
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'& `: }$ c) G9 r# A
" l4 u/ T3 U, E9 w! I- j( J6 Z3 D5 C7 z; M( w
////下面不需改变////////////# q/ W& f V2 D1 q) X2 ?
6 V) F" T& \7 w7 |1 T+ U
var copyspeed=marqueespeed9 i5 h" l. D9 d
var pausespeed=(pauseit==0)? copyspeed: 00 |+ P+ u( `" S6 x" a; R& u/ e6 A
var iedom=document.all||document.getElementById
" q! u8 h5 o2 d: O2 Oif (iedom); d5 A% T* [% S# c$ }( y0 B
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
X7 t1 ], e. P) V3 F- y4 kvar actualwidth=''
Q' F) T* A/ E$ f7 E. bvar cross_marquee, ns_marquee$ s k1 p# n( A
6 }2 r2 W" H+ v
function populate(){" ]# s. U" K( E. [+ `
if (iedom){, d: E0 G5 _# A6 Z, ?8 S
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
: P- ~9 D, W1 Q+ ^% `cross_marquee.style.left=marqueewidth+80 @8 n8 {6 z4 c+ f/ c
cross_marquee.innerHTML=marqueecontent1 n) C6 D+ y+ f5 Z
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
6 Z9 P, u/ }$ R}
( [. u- Q) Z4 Q" Qelse if (document.layers){" W% @3 Y' c: ^4 k( `
ns_marquee=document.ns_marquee.document.ns_marquee2
) M7 ^* Y3 }# H# |ns_marquee.left=marqueewidth+86 ^) |5 c2 R, q9 q
ns_marquee.document.write(marqueecontent)- s8 b$ H+ A, E
ns_marquee.document.close()4 R/ y+ }( m+ p
actualwidth=ns_marquee.document.width
: x7 t9 b' W3 f- a5 o/ P- r3 c/ M; Y}
0 k3 a2 A N0 \! b I% s* Glefttime=setInterval("scrollmarquee()",20)
0 d; m- X- j( X}
4 x+ R- }3 g3 i# \( e* b/ `window.onload=populate
# A/ x- l9 Q& W# w b b9 D
& y$ a5 |8 X+ k2 g' y1 i, U$ Qfunction scrollmarquee(){
$ f! ~" m3 x% y6 `$ Oif (iedom){$ B2 }' M7 }" W/ E3 O# ?- t
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))1 u, b- z& S7 r1 m1 g, C" y; w2 L x
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed% o0 }6 Q- G& [" m4 k) q: s( \
else3 _% F. b: {4 R% V# [/ @2 X; y! ?% J/ W: q
cross_marquee.style.left=marqueewidth+82 y0 `+ E9 n$ H& P5 @) w( H9 q7 T" I
% x0 A6 D' A" I0 a+ p1 b f. k" G
}
" C) s& u/ S8 N9 R' g9 Pelse if (document.layers){. T5 p- z- i3 P# Q% S! _
if (ns_marquee.left>(actualwidth*(-1)+8))
$ @# X, X# `1 c- dns_marquee.left-=copyspeed
/ ]/ w8 Y+ x Z; N- ~. selse' I; A$ w: A: v! p8 D8 H: H$ x. _
ns_marquee.left=marqueewidth+86 S3 j9 T# ^: r: D5 m* |- }3 S
}5 a- l, J" F& m7 U6 S8 U/ x
}
; y% [+ X4 U" F* q9 w, R2 D1 m! C) n. ?
if (iedom||document.layers){3 e3 \5 @7 K8 C! ^: R
with (document){
: y( T- q: E* ?9 Pdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 ]" R+ L0 v4 P$ J
if (iedom){
8 j, T2 t! @' O+ W" B+ _: a: _# y3 owrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
( F1 m4 n; z8 R- Cwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'): F* }* J) C, q3 S3 E! ~7 P
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'): o, {* W2 L h/ ^- A k" X
write('</div>')
" o/ |1 v& K4 J% O/ b+ y& E}$ m5 ?8 l7 K$ b$ L _# H g' P
else if (document.layers){
( w/ M+ s7 Z9 I& |write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
* L$ I4 a$ U% X. M- h& V, t. j2 B5 [write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')7 L5 j3 h# c' G2 |9 i/ ^7 \
write('</ilayer>')
9 P2 I2 A6 e' D8 S; h}5 |. Z5 K; W# L) A3 f% \8 X( C2 L
document.write('</td></table>')8 L) G n; Z/ ~0 k; O4 u% m
}
: u6 E8 l# C6 Z8 W}7 a( L9 o( Z7 y& Z
</script> |
|