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

|
网页之跑马灯文字特效
//修改宽度' U9 } k: z+ O( R' ~( @9 R) D, t
var marqueewidth=300
! G. k/ j+ v& j" D9 |4 p3 W1 k//高度/ e, \; F1 L0 q! L. X- R. i3 q
var marqueeheight=25# \0 D. e" V/ L/ J5 \
//速度(1-10)
! P1 p6 r! y+ e& T( Kvar marqueespeed=3
! r8 m2 d! J; K2 \3 }4 V//背景颜色
4 V/ |; ^" I0 l( W6 tvar marqueebgcolor="#FFFFFF": M( L+ [+ M8 a: p
//是否能暂停 (0=no. 1=yes)?0 J0 d; R: K6 K, M* `% h3 u/ ^
var pauseit=1
7 M4 w; V, G. C
+ Q/ b# C1 G W# U//修改显示内容
6 M, Z2 _ d, k. Rvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'- g$ d1 F$ p/ X; I" m
, ^0 m! |6 Y2 j3 O: I+ D& D* c
& O. D% v$ J% s9 w# |////下面不需改变//////////// N3 R! F! x8 `& I7 W
- ?( K: F& W7 F" uvar copyspeed=marqueespeed
$ V2 h8 V% p7 T9 i0 ]% N) H6 y6 J% @var pausespeed=(pauseit==0)? copyspeed: 0- P) z9 h/ p) G3 k1 x/ p( l7 C
var iedom=document.all||document.getElementById
: ?/ c0 q2 k$ R9 k" F* \( x. B ~5 Fif (iedom)
$ e; p6 Z, z, @& I7 ?document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
3 e# C) `2 U V( Q2 g* w* O( gvar actualwidth=''/ ~& H+ i6 Q5 ~& f8 M
var cross_marquee, ns_marquee3 t7 Q6 q y$ w) V6 l: G5 N6 a
- t: H. R8 o' b- n2 z3 Bfunction populate(){0 H1 w5 p4 p8 y: ~/ B
if (iedom){3 _0 u' k6 h* x: T T ]7 @/ K* K
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee( ?" J3 h- y9 w9 W% }
cross_marquee.style.left=marqueewidth+8
5 E8 n6 U8 Z3 R s6 n) u9 g# Q! Tcross_marquee.innerHTML=marqueecontent6 C6 x& m. o( I$ c. O7 Z' o
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth7 e8 R) Y; w3 ^# \! ?- v
}
% P! {6 k( r: V' o6 B4 f: m) Relse if (document.layers){# B+ D* p6 Q9 B
ns_marquee=document.ns_marquee.document.ns_marquee2
' F8 M8 R: [. Vns_marquee.left=marqueewidth+84 i3 d, X% i( a+ J8 J; h( h5 q6 z, S
ns_marquee.document.write(marqueecontent)
: o. u9 h @4 f$ C$ U3 Zns_marquee.document.close()4 Y1 E( D! W* B& {
actualwidth=ns_marquee.document.width% z6 q3 W) v3 f3 D4 A
}! k; e0 N5 u5 C3 h& U) m5 t
lefttime=setInterval("scrollmarquee()",20)
! `. h5 P H* J" p}" I E. `5 X9 F. g- x
window.onload=populate
* O* L0 {) ]! S- i' l, @, g1 c. L5 J% l. u |3 G0 |* U0 [
function scrollmarquee(){7 q3 j- k" h! h6 {9 s+ L7 D& u
if (iedom){
, X0 \( y9 J0 B$ @if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)); |% e0 c+ D; o
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
0 H' Z8 V( W$ J2 I W* W( Xelse
2 w& C. s) X4 b _: a+ hcross_marquee.style.left=marqueewidth+8! l! g3 b7 Q8 Z/ B3 U- \' m( [
& X& u* T2 w9 H
}
. {5 Q2 L# k' W& Z: O8 lelse if (document.layers){/ y6 `( B) _9 b, o9 o2 v" i
if (ns_marquee.left>(actualwidth*(-1)+8))/ b( Z4 K' V7 l
ns_marquee.left-=copyspeed3 u5 ]$ P$ S4 |3 ?# U3 V# E# ^* g
else
3 \ r* ^% n1 f5 i3 O: Z' ]- Kns_marquee.left=marqueewidth+82 ^) w* {) s8 P/ K; l( N+ ~
}' a, b# m9 s" |( ]2 e/ n
}
; ^( u8 r* F) m2 I# K- u! b4 d9 i1 p! e4 Y3 X1 s9 G$ I
if (iedom||document.layers){
/ Q' C# b+ d* C h+ @with (document){
* z/ t! H% n. qdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')4 A: C# ^: X2 C7 y
if (iedom){0 z; V" T) U L' ^3 u
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
9 z4 s& d# Z, s4 P- Gwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
, S& X8 s _) Y1 Uwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')6 Z0 _0 _: H4 O: v% B
write('</div>')
s. G( Q. O$ h6 e0 z& k5 P& k}6 m" T- [5 W& _6 F5 @! `- T/ q5 j0 W
else if (document.layers){# Z3 F( l8 ?' q+ B8 Y/ L" I& b
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')5 e, f# U, r, r
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
1 f" U) T! n! D5 kwrite('</ilayer>')
) \3 f4 Q- g5 ~9 ?. l}
7 ?0 y, E" I" ^" A" ]/ pdocument.write('</td></table>')
, S2 z g; D, f- `; H% ^}
# ]$ M/ Q$ h2 y, C6 ?# B}( k! r: W. |, {7 Q8 P8 N: P* F
</script> |
|