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

|
网页之跑马灯文字特效
//修改宽度
0 L$ z6 T# j: C2 G* Q7 Wvar marqueewidth=300
. J7 W8 g$ R" `( @: D, M2 B//高度
7 D4 x: v6 z' f0 B' z7 Q/ ?var marqueeheight=25& g7 S7 H6 b0 H- ?1 e* ^) x c
//速度(1-10)
7 |6 K @$ @& _ @9 ^var marqueespeed=3
( ^/ [5 n% G0 R: B; t$ o3 }//背景颜色5 @# S. r( a0 b4 e, m
var marqueebgcolor="#FFFFFF"" ~& ?4 i" Z5 ], Z4 S0 r- }
//是否能暂停 (0=no. 1=yes)?9 {2 g/ g6 L7 f" C/ i
var pauseit=1: ~8 s/ z- u* m; i3 R
$ u7 k; g( A1 I/ M8 D: q//修改显示内容/ v' }' g* c7 \: j. p( Y, c
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'5 h' D; X+ M7 Q% W: Y
+ _, r" c' b! F8 ~2 R( U
5 C' q( H# Q$ J( ?$ B9 ^: L1 G////下面不需改变////////////
( m" v% j" y9 h- k! z
& A5 B# I. z5 l. } H- v, Qvar copyspeed=marqueespeed m0 j" N/ g6 @8 g2 [+ ?) x- O. Q
var pausespeed=(pauseit==0)? copyspeed: 0
- ]) _# r4 U! H2 ~+ yvar iedom=document.all||document.getElementById& z) r2 g& {& K" W& y
if (iedom)8 A+ x- q/ Z0 L# J' \4 s
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')0 S3 _# ]& c& @7 G
var actualwidth=''
+ _. v) L* s1 B7 l1 T' X6 {* ?var cross_marquee, ns_marquee
- J; `% _/ T' G& I
9 P9 h4 J3 d7 Rfunction populate(){
% L5 x: w! S7 f5 R% f* Fif (iedom){3 `9 k3 E* Q2 m( U- n6 k/ ]
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee3 F5 a. z( d/ a: l; h$ w
cross_marquee.style.left=marqueewidth+88 x' k, B0 ?% B) ` ]& y) K( S
cross_marquee.innerHTML=marqueecontent' s8 v* f3 v. [0 v5 Z& Y
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth$ g0 F) H2 \' [( d! x! F# i( N. v
}
7 B* r# ?% I# M) F1 g8 @. z# belse if (document.layers){' A g0 [; h) E+ p' r& Q( w
ns_marquee=document.ns_marquee.document.ns_marquee25 q5 _) E& W* Y' B! X0 J5 E
ns_marquee.left=marqueewidth+8% Z$ M$ L5 ^! j& D9 N! ~3 k% n
ns_marquee.document.write(marqueecontent)
( c/ _' k( ?% I$ A9 ~ns_marquee.document.close(), C% N4 P* i7 @9 U: C0 S0 r
actualwidth=ns_marquee.document.width
$ [3 v) ?1 L6 {' X}( m3 d; _4 i0 {. Z8 [+ a0 D! L. r
lefttime=setInterval("scrollmarquee()",20)
2 U; _ E4 b; X3 _1 j3 i}
! p6 z8 c) A% l+ fwindow.onload=populate- R1 I. U8 U ]0 N' s7 b _
# o/ p# ^, j$ `4 k
function scrollmarquee(){
$ ^0 h. e* \5 t+ Zif (iedom){
' h( q7 S: n* q# O0 eif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))# q( I3 i6 e( o4 s( s* H4 f: l H
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed4 w& A* b: L1 Q/ F
else+ k6 K5 i7 V1 b0 g
cross_marquee.style.left=marqueewidth+8
5 I u( \4 Q: E- P4 G) p% a8 V
: E1 R4 a" u# {+ b; g}& k. u1 K' ]4 J |1 @7 W
else if (document.layers){: k m2 ^4 I3 _" G
if (ns_marquee.left>(actualwidth*(-1)+8))
0 C8 K0 s! g) J# I; [ns_marquee.left-=copyspeed' h# i" y1 m0 s% Y* Z
else
! a/ u4 p- f. M7 O; h4 z r- ons_marquee.left=marqueewidth+8$ N$ d9 D$ v' a0 A( e! Y& _
}
6 V6 P+ w5 r2 [# W2 H3 X. \5 B}
. O0 }5 ]( B4 C q
6 E7 S2 c; q5 Wif (iedom||document.layers){
9 [3 I7 |2 K O0 Awith (document){4 r' B3 v3 V0 j3 ?
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
$ n$ G0 b5 Z9 Q) B# ]# Aif (iedom){
0 O$ O6 |+ s: D9 @) Lwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
( n7 H! _9 O+ l6 mwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')2 l' _5 ~, k- ?! @0 z
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
* N4 Y5 N) K1 rwrite('</div>')
, j, B7 |: S' ]0 h; U. Q}& x. T% h5 U. ~! d# T6 g
else if (document.layers){
$ C9 d$ t& h2 ~- u$ nwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
0 D6 D8 P$ H. c" f8 ?write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
9 _( u7 V. l+ Hwrite('</ilayer>')4 Q( G [. Q/ g6 v0 d
}. o& J- r+ A' ~" |8 q
document.write('</td></table>')6 m3 X: p$ m+ Q0 k$ x/ i
}
% c- {# V" F- Q0 f9 O* A$ j}
; y' T3 M0 D- Z3 y8 t- T0 k</script> |
|