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

|
网页之跑马灯文字特效
//修改宽度
) Q- n3 E0 O' d: d) j" rvar marqueewidth=300
7 K( {1 Z3 D$ a//高度 r. J/ f! l$ i" x7 h
var marqueeheight=251 R3 x& C' N% M. C4 _" k
//速度(1-10)
- \8 [( t0 o1 B. B# c. p bvar marqueespeed=3
6 h3 F- C% f: T* L//背景颜色
+ ~4 p5 U& D4 Yvar marqueebgcolor="#FFFFFF" p# L3 ]5 s7 u5 t
//是否能暂停 (0=no. 1=yes)?% f* V: f, o7 {* d- p6 }6 u0 z; N# E
var pauseit=17 [( p; |; P7 z0 o# F1 s; U
, j1 j2 T3 Y6 q. y' w
//修改显示内容
, Q( T9 K) R. |2 d) w: ^9 _var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'- {0 Q% r1 o) l+ `+ N* n- e
& b! a' Y0 n4 P4 ]( }' c3 ], a2 e% q2 \; D m6 {
////下面不需改变////////////
; }: h; k7 ?5 x2 k- o+ i" _7 w, K* j
var copyspeed=marqueespeed! F4 C5 |. e' w4 z& l
var pausespeed=(pauseit==0)? copyspeed: 0% V4 Z1 }" q( q' \; _) l. ^# M; u
var iedom=document.all||document.getElementById ?5 X5 F( d% z- }8 @! P, r
if (iedom)
k; ~* Z4 ^# u! Y& odocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
6 p# z' ^. E+ V9 q% D# ^/ ivar actualwidth=''
' k0 n- ]2 t' B# H+ ]7 l, ^9 Zvar cross_marquee, ns_marquee
4 M) d: A* q+ J5 h9 W7 ^
! h% P j$ A* O* @function populate(){! `" |% x* N6 Q% k7 k( s. c
if (iedom){; h' y8 K2 ~5 s; V( x5 S: K _8 _
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee& s$ H/ U0 n2 H$ S6 ?3 \0 X
cross_marquee.style.left=marqueewidth+86 P1 i/ e4 `6 }, {# h& ^' h& c
cross_marquee.innerHTML=marqueecontent! v7 J# V e( |; K8 g
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
# w5 H3 |6 a7 ?3 J7 ]! {}
# P* W# k6 [0 k, D; m7 Yelse if (document.layers){
/ p" |0 [8 I M: i Zns_marquee=document.ns_marquee.document.ns_marquee2
j9 _5 D. s2 U X; d/ cns_marquee.left=marqueewidth+8
! n4 Z+ Z& `% O1 c# x6 E9 a3 Z! }# y" fns_marquee.document.write(marqueecontent)1 }% R: L! |+ c
ns_marquee.document.close()
4 t% ~! ]8 O5 R$ jactualwidth=ns_marquee.document.width! N+ ~8 C9 n( Z! a- ]
}
# q$ ~, l) F/ W5 G! W( `8 T, Slefttime=setInterval("scrollmarquee()",20)
: k2 u6 D9 ]7 Z. `3 |3 R}
2 P5 {4 c' H! X" l7 E' awindow.onload=populate( x/ ^4 t& {+ E/ ~" g2 P% Z
. o4 k3 y; G0 j; P, w0 j( L
function scrollmarquee(){* ^4 S0 e3 H3 B3 }* H
if (iedom){
0 j& R5 X4 z( f: Q3 H3 M. C5 Eif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
* ~6 ?6 i0 J8 r* t8 T0 s' @- Ccross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
1 s: Y/ z/ b3 M0 j* `1 a& x; I$ a3 Aelse
8 a. x( \! g# l& k# hcross_marquee.style.left=marqueewidth+8
( ~- _2 g$ K2 c0 M/ z; [6 b! t- L4 i) N4 e/ t2 `
}
* P) A3 R! G' M2 gelse if (document.layers){" w( K0 |' n5 N% a# k5 r [% J4 u
if (ns_marquee.left>(actualwidth*(-1)+8))) o) _$ u' M& D1 u
ns_marquee.left-=copyspeed: n" |" P5 A; { L8 t& r
else- |# t, @ u+ A5 _1 `" r/ }! H
ns_marquee.left=marqueewidth+86 V( N4 ~; W4 V
}
7 y* L1 W# V& ~& K' ?}
6 x a. U. Y& u" c) t5 I$ J0 S% P0 ?% y( a( g6 E
if (iedom||document.layers){
9 H+ }9 c8 ?1 o$ X" }with (document){3 e2 x( }# r" k% B
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
% E5 }* m3 M6 Yif (iedom){& [' k/ h0 |8 h) v" j- y, ^
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
+ @: S2 p. M# p' M9 _3 }2 uwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')! [- k$ H* n% y& W/ U2 p
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
, b3 U0 O5 I# Qwrite('</div>')
5 z& U7 D% h# m# P$ L; L}
' c; ]3 `4 y, @else if (document.layers){0 o O- s7 I! D/ v7 v5 q
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
! k- F9 x& b3 } s0 }write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'); k: Z# f! P% o: N" L
write('</ilayer>')- \1 z8 A: c+ b, C6 q$ d
}6 p. A- F& B# h8 j( o! Z
document.write('</td></table>')) Q: d3 Z* F3 V) p
}
4 Z8 G( O5 y7 v2 w# C8 W) {& [}
8 @4 j% X9 b* {2 j7 B</script> |
|