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

|
网页之跑马灯文字特效
//修改宽度
9 ?; m& D+ ]; Xvar marqueewidth=300" x' s. Y6 W& C7 J) Z
//高度
/ b2 U r4 f8 Avar marqueeheight=25
* o- z& \. O4 T' K# l# e8 N//速度(1-10)7 m# X. j6 B& m! W7 |* v
var marqueespeed=3 M/ Y$ W; {4 L' v% A0 M
//背景颜色8 W: R( b0 W U9 H @6 R
var marqueebgcolor="#FFFFFF"4 q2 h# Q- l) e! @/ M4 y9 {
//是否能暂停 (0=no. 1=yes)?2 A" D: K2 N+ ]7 Q; S/ y8 |& @; T
var pauseit=1+ S$ ?* }+ ?( l. i
% `! `8 c) p) q) Z5 L b
//修改显示内容
! L" a: j9 b# @, w1 b- k- @var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'( h* \; t! \! f( h% V
% R5 }- y+ \5 l; }
3 N; [7 n7 K7 z, `' [" l8 p6 W
////下面不需改变//////////// A: J8 o8 x* V* M: Y% Y
1 n' A' |' a2 P* }
var copyspeed=marqueespeed) z8 p7 q2 i% r- ~4 h
var pausespeed=(pauseit==0)? copyspeed: 0
/ U' u* x* H$ U# ^. H, M. I8 mvar iedom=document.all||document.getElementById. t- ^5 Y, D! Y
if (iedom)
: s6 {( o7 f- e) G1 |, Ndocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')& D! T1 V3 G, b6 ?8 L
var actualwidth=''- J# {* g7 u; v1 S; U% p1 G
var cross_marquee, ns_marquee
' C e/ {6 ~& ^1 F$ D1 L1 ~; U4 L k/ h& S* m2 ]0 D0 ?
function populate(){
$ z) v/ X$ i8 H6 Pif (iedom){+ l2 p7 H* |6 c/ K7 S5 C
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee' Z5 {6 Q. R# Z4 y7 J, E$ J% ?
cross_marquee.style.left=marqueewidth+8/ i) | X# i3 f$ I2 q% I' S" @
cross_marquee.innerHTML=marqueecontent
- h, A4 l- t# S, B! Oactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
, Z: D# J6 S5 e9 \9 p}
5 Q" o5 s) |+ [/ W* K: ]else if (document.layers){
# H' v( p6 A& E% D& H( M/ v* \ns_marquee=document.ns_marquee.document.ns_marquee2& k& p8 G, D! r/ k. G7 T8 T
ns_marquee.left=marqueewidth+8
+ X$ c! l( M0 b' [" n! Y1 K+ z- \: S: Xns_marquee.document.write(marqueecontent)# c; y y$ [0 i C; |
ns_marquee.document.close()# T) }* L+ [1 H4 Y; A; B, l
actualwidth=ns_marquee.document.width
. ]- M9 P0 I) [: b2 p}2 } N9 Q; n* Q3 v) Z
lefttime=setInterval("scrollmarquee()",20)/ Y3 k- U5 I3 P0 J' J7 T' X
}
1 L& D! a: H' p, B4 t7 D, v! ~window.onload=populate
+ {4 E/ K2 j/ ^$ w) s$ P+ n7 r5 J! ~
function scrollmarquee(){* P, B- r3 G3 T, u8 Y
if (iedom){
0 O$ g# T/ |( t o" [- y7 ?if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
2 D# L! Q, Q2 c# ~& icross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed2 x6 _, o g- G+ T8 J+ \- C
else
9 z" S" c% u, \7 p! Z7 Bcross_marquee.style.left=marqueewidth+8
7 F; ?. S* U0 Q' _/ J- R1 I* b& Z3 I7 ^" U: o
}) w; V9 H2 J1 [$ v* S4 M
else if (document.layers){! k5 @. \/ j& A9 v) b
if (ns_marquee.left>(actualwidth*(-1)+8))
9 H$ f) j; P; q9 M. o9 w. z" ans_marquee.left-=copyspeed; Y1 @) T2 Q- r% K5 K3 L1 P
else* r, W% K( k9 @0 L7 N& f
ns_marquee.left=marqueewidth+8, s# k& ~, T# U; p: c2 k9 U
}4 j8 w7 ?5 I- @/ t# Y% x+ C
}! |; u: h8 ?9 Z7 R2 o
9 `4 G& @- H: Z, z) M) ]" m
if (iedom||document.layers){
& e& R3 n6 N6 i( d+ Lwith (document){' l) _' M' @0 L7 E5 L! M
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')* W- J- Y a9 L
if (iedom){
5 i D' L- q5 n$ @6 mwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')4 a5 T+ W3 K- x) |$ @2 ]2 [5 r
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
( l; i) l" N2 h0 H8 P, @ Bwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'). N d, z* s8 Q+ z2 |3 g+ j
write('</div>')0 g0 [' ~! e( G
}+ C) U ~0 [$ G8 ]$ o; B
else if (document.layers){
) F# K; s9 n2 v3 m. o9 \write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')+ f, h! I/ D6 I: }& u6 y% e! C3 |7 }
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')" @$ S; T! O- M1 X
write('</ilayer>')1 H. X, ~# f& _) n6 a' @
}
; p$ ]) p! D! H) C" o1 F$ w) N7 t, Jdocument.write('</td></table>')0 V. @4 y3 l% r# V) ]
}! H: b$ G0 p$ Z6 X% M
}9 p! a4 v. | \1 V2 P
</script> |
|