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

|
网页之跑马灯文字特效
//修改宽度
! U \' p' w* I; Uvar marqueewidth=300' R9 i9 J' a, J( O8 s
//高度# C5 A5 h% T* Z+ ?9 ^6 \
var marqueeheight=251 s4 ^) {* _2 i6 G, ~: d. R
//速度(1-10)
' A) t7 k# f' W: ?# T$ Mvar marqueespeed=3
# [$ T% x8 S0 i3 J0 f0 x6 Q2 S. X//背景颜色- J/ R. A. c7 \# p
var marqueebgcolor="#FFFFFF"# b7 ?" l# B7 _$ K( y% p Z
//是否能暂停 (0=no. 1=yes)? G9 [4 C0 q. W: w1 [; T
var pauseit=19 X: @# W! h, z( f
* m* j; j X+ R- `* y2 R3 Y( K4 Q//修改显示内容
/ |5 T" P) m3 V3 M" @var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
+ ~6 U: d n9 h7 p6 J+ M; M
5 c, ]' a3 p. a2 D5 b1 \" ?$ p, b0 l- K0 @
////下面不需改变////////////
6 R/ ~! F5 O6 e K: ?# g0 y/ Z* w9 ~' ?& k# e }
var copyspeed=marqueespeed9 o1 M+ @7 v* N0 X5 ^, D* h
var pausespeed=(pauseit==0)? copyspeed: 0 I7 J# R/ K4 z" S2 {" j) Z: Y
var iedom=document.all||document.getElementById% Z/ Q. A3 X' [- m4 Z
if (iedom)
|4 l7 n( D8 N6 J6 fdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
3 p+ E; w9 j+ g) nvar actualwidth=''
6 d) R# ~3 a! u/ F- a3 uvar cross_marquee, ns_marquee
) n% n) p" L: r! t9 L' I* a
# |7 _' v7 X* V0 V7 p% N Tfunction populate(){
7 k% K. v6 ?- Z5 aif (iedom){' K5 y9 G) D" w- q( }5 @
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
5 k3 ~* G5 W2 d: kcross_marquee.style.left=marqueewidth+8: P0 p0 e; k2 I6 f- Z' O
cross_marquee.innerHTML=marqueecontent
+ j( m7 q2 z, z M; a" kactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
7 e' m# ?: t x% _}! v& i( E5 r9 U5 ?4 N" I
else if (document.layers){
6 n- O, ?! v2 z% V( {0 d. ons_marquee=document.ns_marquee.document.ns_marquee2
b5 z9 l8 [% q' w( S& Gns_marquee.left=marqueewidth+8" W7 u* H, C! ~/ Q
ns_marquee.document.write(marqueecontent)
! X. y& U" j* r8 nns_marquee.document.close()3 L) ?) g9 u z, J
actualwidth=ns_marquee.document.width
; `" r5 H& R, n- z& @* z% d}
9 @# b9 o' ]: I3 q* w( X* `lefttime=setInterval("scrollmarquee()",20)* V4 |, t- K, ~) T* q% ^9 @
}7 F% Z! r) o. v" D0 _8 b% ?0 \
window.onload=populate J' R- a/ V& G8 \9 c
8 I1 C; y5 f% d5 c& Kfunction scrollmarquee(){
7 G; { S$ o2 I' D0 N+ yif (iedom){
6 M7 O4 F- K j* c8 d$ Q6 @if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
% n- v3 E! j- Ncross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed1 O* q9 k- E. j$ }" ^0 T* J7 G
else
: I) [% F A0 w3 a1 K7 Q3 ncross_marquee.style.left=marqueewidth+85 R* p$ z, m( `- J1 H- }
/ G# t, X4 G9 C M1 c4 b" s
}2 P8 L$ C0 d% K/ x& O" j$ U* I$ v
else if (document.layers){
3 [' [% t! u" r! Lif (ns_marquee.left>(actualwidth*(-1)+8))
3 C6 b$ o' Z; w1 Q* }ns_marquee.left-=copyspeed
4 a# c! V+ D' U' @2 Qelse7 M, L, j1 w$ h9 {8 z; b
ns_marquee.left=marqueewidth+8
2 T; p/ N1 ]8 Y. H5 ]( n+ ^, {: z5 U- y7 \+ W}
. X4 O9 j/ A3 C5 Z* A}
% c* D3 Z+ P. `$ x6 j" _) Q& S: A& C& Y. L& I! x
if (iedom||document.layers){, y; X9 S& S: F/ E
with (document){
% p& G7 B( N# n( ?& Pdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
2 X) v4 N/ Y N" v# f, A; Iif (iedom){; p' H& ]0 ^7 ^. o* P: ~
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">') S1 Y2 x8 \5 | `( _' S
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')- ^5 k$ F `. }
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
! Q6 V* g$ H* n3 A. V% w9 m- w) X& Mwrite('</div>')
/ T& T9 [2 [6 y5 R* W7 C+ W0 f}% [9 b F% G3 A: z& e
else if (document.layers){( W4 f9 E* ?: k5 B) k, R3 \
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')" S: G( J0 [5 W: N9 d# g
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')8 W* z9 B/ W( }7 r3 N5 r* l3 R
write('</ilayer>')
" Y- e4 s" \' _+ {. C- C}
( M0 K, R" c8 j: @, R* Pdocument.write('</td></table>')! e m6 y( s8 L
}+ N8 g& C: A3 P! y, H
}7 q2 z! f' `5 W- A G4 I
</script> |
|