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

|
网页之跑马灯文字特效
//修改宽度
- [/ q' z& d2 l$ w2 _var marqueewidth=300 ?" G; x* k2 g$ l8 s+ k
//高度& Q5 \8 x: W2 q2 V; l5 D
var marqueeheight=25
* F6 O" W; q# R//速度(1-10)
7 m9 a; x% B: E+ C5 n; v7 y/ Cvar marqueespeed=3: c; Y6 a! A5 l$ a" q
//背景颜色
% F. f" K u2 J6 ~/ f% ~var marqueebgcolor="#FFFFFF"
/ F, t. q u; q3 D1 h//是否能暂停 (0=no. 1=yes)?
4 N3 y* I+ H% Z8 s: e9 {' ]& U6 D! qvar pauseit=16 q9 _5 ^$ Z4 x& ]- N& Q
. O3 u2 B9 H: a5 \4 |7 t//修改显示内容
& g' R+ J4 v9 ` n" [) dvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'+ A# `3 b% }3 @6 u+ N1 d
& [" Z1 d9 s! B$ \ P8 R+ j3 V9 O% K C8 z; Y
////下面不需改变////////////5 j/ O( J$ v! _# W" e
. n1 B: q$ v! p. p" w4 A& m2 W
var copyspeed=marqueespeed# U6 t9 ^3 J6 u# ^- o
var pausespeed=(pauseit==0)? copyspeed: 0
9 R& K% d2 O+ `; {- ^! V& @# K6 {' T. kvar iedom=document.all||document.getElementById
9 n$ \. S, V! @5 y# eif (iedom), v8 Z3 ?. `# j7 h
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
8 j3 k2 [# i/ Pvar actualwidth=''3 f: ~( q9 C( W
var cross_marquee, ns_marquee
2 v, Y) t; h9 H2 {% ?" c! D" @2 _( h- Q7 X
function populate(){' g# q7 G* U9 k
if (iedom){6 P) X% D& ~7 {
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
: y" B0 J$ O: ]* z) y, ^9 e! F8 d& xcross_marquee.style.left=marqueewidth+8/ Q; f8 R% b4 i% D
cross_marquee.innerHTML=marqueecontent7 t4 t/ l# Y9 K1 ^% I7 }( m1 |( h
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth- k5 X# _5 `( @- b2 e
}
5 X9 H1 z3 [! \7 }) Jelse if (document.layers){
9 ^# d! V8 Z! o9 Ins_marquee=document.ns_marquee.document.ns_marquee26 C+ [) E' n1 Y# R
ns_marquee.left=marqueewidth+80 b1 S1 h, l- I# V5 {, |
ns_marquee.document.write(marqueecontent)
/ _$ Z9 A! o2 O6 rns_marquee.document.close()- H- A4 d7 @9 T1 a- U9 F( ?/ d
actualwidth=ns_marquee.document.width
! S. J6 i5 W. a7 w! N}; o6 N8 [- D- q% z3 [
lefttime=setInterval("scrollmarquee()",20)
' \+ Q( o& f0 W}
& A! y' i8 n( P. F+ Owindow.onload=populate3 d: \3 O' V3 X/ Q. X& J9 X
* @/ G; ~; X( k. |7 s. J5 ufunction scrollmarquee(){6 ]5 m9 i/ g }
if (iedom){! ] v# u' S* L' A# h$ T8 d! ^/ \5 m- [
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))" ~/ p- @+ F! f5 q; z+ G' w3 n
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
; I9 R. A7 D% E& R( y$ Lelse
! R3 [) h1 k5 b4 Scross_marquee.style.left=marqueewidth+8
' A: g6 d. |& L! f' X* b2 D5 J" n, l" i6 v' }
}7 A- D5 }0 G$ u1 x0 R% y0 z
else if (document.layers){
0 N' q% c& }! O) a- f% uif (ns_marquee.left>(actualwidth*(-1)+8))
; K% @% B8 u$ Y& |. Xns_marquee.left-=copyspeed
; y3 X9 L3 f& K- c8 o% P. f' W! Aelse! \$ e% \( v' b9 I
ns_marquee.left=marqueewidth+8! n7 R$ k3 x6 G$ R: v' E* w
}/ Q8 w6 I. |1 M! [! Z/ k4 C
}( j7 ~; g, \8 r6 q G% j/ j0 V
- `1 J* H' H6 E6 K5 c* k; t# g
if (iedom||document.layers){/ J: ]& H7 w% v Q
with (document){
1 u* j' }7 I; l+ {( q# |document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 u$ l! t; S# p9 t3 n; w$ X# b$ O
if (iedom){( p* T% D; V& i. \" e, I& E d; y8 d3 r" _
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')( E. q; H& l+ S- R
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'). C5 A, T5 i- c7 \
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')% x" e+ a; {+ ^/ i% q
write('</div>')
5 B+ p' U/ q! V6 {$ x}
% y1 D& z: p! o2 c1 S& P% n4 yelse if (document.layers){
$ m; D! C. g+ I( ?- C; Fwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')( @! @; W8 Z+ g4 \
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
, S& x0 e d2 {+ x; p8 ^write('</ilayer>')% w1 w( V$ @: g) e: z2 G; A1 ^
}: {6 X N8 u6 J5 p* P! k. C' l3 G
document.write('</td></table>')+ G" U1 v8 K8 Z% k
}
# w: S3 E' x& v6 a+ [ E6 N}# U1 K' m, |8 I
</script> |
|