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

|
网页之跑马灯文字特效
//修改宽度
7 a% h* _, o; k) p3 @* W% B' D9 gvar marqueewidth=300
8 `0 b) N/ `. G9 u; }9 |8 _//高度' e& E- x5 U, k6 g8 V" W- L
var marqueeheight=25- ^8 P6 e! W: t( n9 u
//速度(1-10)
: \: B* S# _5 Y1 A$ G, t3 svar marqueespeed=37 P9 A' J/ `0 T
//背景颜色2 ] v$ s) f! [8 d* M
var marqueebgcolor="#FFFFFF"
8 ? i1 T( }+ I" m6 R6 V. H. Q# }& d//是否能暂停 (0=no. 1=yes)?! H: U, S" h5 |3 Q9 s8 o1 i U, [
var pauseit=1
( R( L' w0 c3 j, u0 J
! G( X F" N0 H9 p+ G6 b//修改显示内容7 O8 d4 e) A8 w6 z% h
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
2 i) ]* Y, m/ R+ M% x6 [9 x/ M, G$ W* o) y v/ k
" ^0 v+ A4 Q) I& f
////下面不需改变////////////
) x% Z) j2 T$ c' d4 g6 t! `! b; C0 d0 o" ^( {
var copyspeed=marqueespeed1 Y, l- K6 |7 _ u
var pausespeed=(pauseit==0)? copyspeed: 0 G5 B2 L# z0 w$ c+ B! f
var iedom=document.all||document.getElementById
F" @9 l) b7 Y6 yif (iedom)
8 K- Z% ^, u! {$ Adocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
: r3 K7 a& N4 b# i# w( fvar actualwidth=''
( l) r' v. L; z0 H8 l4 hvar cross_marquee, ns_marquee* E! z; O( Q4 Y5 T) i" v) \8 e
' o$ Z+ u1 v4 \: x! G
function populate(){
" m+ {4 f9 c- |if (iedom){
+ t; X: a6 G7 zcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
: _" q- x$ N7 j& V, G- ocross_marquee.style.left=marqueewidth+8
/ @8 ^, [3 E+ X& o% l8 F/ Q6 wcross_marquee.innerHTML=marqueecontent; K- ?1 |$ F1 u/ N
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth. {& K. w3 U4 ~) T) P/ k
}
1 j9 G+ s, a* E( yelse if (document.layers){ U* Q% z }) h( s' T% _7 M
ns_marquee=document.ns_marquee.document.ns_marquee2
! C1 L ]- v! Q7 j& }! D+ g0 A1 pns_marquee.left=marqueewidth+8
7 k5 _8 y2 j0 x" \: @8 `ns_marquee.document.write(marqueecontent)& B( `" @7 y+ _# P
ns_marquee.document.close()
A; ]2 v2 w. w) Z7 Z0 |actualwidth=ns_marquee.document.width
Y) w, s% Q) W" L3 B( F}; n6 g& b, X; A& l8 g/ ^& u3 R
lefttime=setInterval("scrollmarquee()",20)/ n3 N6 Q; e* A+ I% I6 p/ u" i* K
}
% {1 q7 W/ J, c1 owindow.onload=populate* ^' p+ ~, `% g$ C3 u, Y
6 Y- j9 h- a* ^( Hfunction scrollmarquee(){, [+ X, \+ S$ h
if (iedom){( }, @$ M$ E) W& t- Z
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)); _7 Q3 E/ m; c( Y D
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed5 o ?1 _- ]9 k5 \7 L0 E
else
2 r+ V& ]1 i! \# ~. ~cross_marquee.style.left=marqueewidth+8
& ~+ a7 n3 @; D; P1 I! i7 c+ b3 E: J# c- o p
}! _! p! Z: ]$ |9 c0 w" x; Z
else if (document.layers){
, M# _7 u( u' B8 zif (ns_marquee.left>(actualwidth*(-1)+8))$ i! v* V! R, Y( z+ j8 [
ns_marquee.left-=copyspeed
/ {% w( Q) B! ^else. ^, c4 O$ K0 n0 U i2 |* x$ b8 C
ns_marquee.left=marqueewidth+80 N" D8 E# A2 n+ }% e, `; g
}
9 Y+ ^( X, x T6 k}+ J: {: \& i0 e: ?
" @' W# H, f A7 F2 A3 {, y2 gif (iedom||document.layers){
& G2 P% c7 t7 F6 [, _+ r0 ~with (document){
. x8 _1 v3 x% Fdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')& F6 c) \5 o: d
if (iedom){6 W: i0 T8 Q, T3 z, i( Q4 G
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')6 w! e; t: W2 h5 F
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'), ]2 O/ R& l7 B3 B& I4 M9 `. k
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')3 ]6 T( s! n7 }+ u- B
write('</div>')* i0 s5 e/ E2 K, ^) K
}
2 P) e1 O8 ?( M) R4 Relse if (document.layers){. ]% [. p! t( t: H; V/ M( l
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')9 \* a" q& o8 F2 d
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')7 X, z E7 ^6 M: O" o# h
write('</ilayer>')# z5 J+ p. u1 @; b' M8 |. }
}
. w! a; z$ H- m0 ?8 {. e7 A! pdocument.write('</td></table>')1 P9 H& k$ d( y: I2 U
}& t* l- V& A! X$ c6 x5 u) a
}, J/ x0 R' j' j" U" O0 f" c
</script> |
|