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

|
网页之跑马灯文字特效
//修改宽度
6 S% a5 f& l/ I" g) F: Xvar marqueewidth=300
$ V9 B3 n. X1 }//高度
3 G1 U3 N* i: D3 |% f" u: N! z: Fvar marqueeheight=25; ]5 Y. w% f( \5 ~6 q# O
//速度(1-10)
/ S$ q ~: r& f T$ ]var marqueespeed=31 R9 o' ]: C; N1 x4 {; u
//背景颜色
* ^9 l8 k. i5 \1 N0 qvar marqueebgcolor="#FFFFFF"; ^& a i4 q9 O7 K4 [- D. _: P
//是否能暂停 (0=no. 1=yes)?' O; X7 v8 X3 s. c% w, _3 d
var pauseit=1
$ o; f( r$ m! ~2 D: z0 I" q; m' \* _% w$ B
//修改显示内容
* C5 W& Y: Q5 X9 A9 f. J! pvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
4 h( i- G9 E5 U8 |( Z( _, U* j7 k3 C& U! v7 G
, }' R t# g$ p+ c////下面不需改变////////////5 i# ^) Z9 h, O
$ `: m3 t' E0 s: z& C9 vvar copyspeed=marqueespeed5 H1 _8 U( k" t/ \. n" i+ G7 G
var pausespeed=(pauseit==0)? copyspeed: 0
5 Q( ?0 X0 k( p, ~3 m, U! Fvar iedom=document.all||document.getElementById
$ F1 u: }1 T- |( p0 p) F$ Q% Tif (iedom)% _& Q- D2 n6 _( V0 ?, a
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')# g6 u7 A) [, C2 D, u3 P/ S ^" S" s
var actualwidth=''
; w: T$ B8 c- |var cross_marquee, ns_marquee- L. Q' b4 v8 [
$ x" C3 {. I; u0 f0 n; O3 g3 v
function populate(){
3 F/ x6 `, I, Q9 Z- Iif (iedom){
# \% |* u7 G( H3 V/ S+ ecross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
) i% Y5 L4 D1 across_marquee.style.left=marqueewidth+8) _( M" l, X. u! x
cross_marquee.innerHTML=marqueecontent
+ g$ q0 H+ s+ [) E! ?actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
/ t6 p' e- [- Q2 t( X}, l: y" y& k- C; v( P! s
else if (document.layers){/ M5 P$ R# c5 c( T* `3 G; T
ns_marquee=document.ns_marquee.document.ns_marquee2
% b2 ?. h6 e* T4 f; E3 `+ qns_marquee.left=marqueewidth+8/ h0 p& q6 T- g; l
ns_marquee.document.write(marqueecontent)- T2 {2 `) ~1 ~4 o. _, z, K
ns_marquee.document.close()% G M3 S0 \' {/ _4 H
actualwidth=ns_marquee.document.width
* ^8 h6 s( w7 o( |}
0 a$ D/ b- R V: i2 ^lefttime=setInterval("scrollmarquee()",20)- _1 {6 V! S, R( d: ?
}$ D. \; h0 [; ?) G7 f
window.onload=populate* P6 u. D( W6 D8 c# }
9 I: e# m( ?/ j8 j" @/ Z9 g
function scrollmarquee(){
6 u1 p/ @& i- n8 Kif (iedom){$ [: d! s- G4 u% ]0 }+ x1 _0 ~. X
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))5 P T) E/ a2 P; ]
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
: c' H/ L. C1 A; e" K8 qelse# M3 f/ _3 h; E
cross_marquee.style.left=marqueewidth+8
- m6 J4 Y! [$ N- l
' X+ O/ r: H) I) x}
& |6 b2 e& n1 k/ L f Ielse if (document.layers){
. \0 k6 j- `1 j1 L; [if (ns_marquee.left>(actualwidth*(-1)+8))1 q1 n6 T ^9 A; l' p4 O, q
ns_marquee.left-=copyspeed5 X! i4 d* D* d! @ q; P
else
) p! o' c: p$ L _ns_marquee.left=marqueewidth+8
6 F8 W( t& `6 j3 o}
4 o- U* N& O/ B @1 z}# ]6 c" b% r8 c4 o u/ Z
7 S3 Y/ U0 z; e9 i |4 a+ p9 |& k+ Pif (iedom||document.layers){
) J1 K5 l6 e4 O1 K9 awith (document){# j, f8 L/ l! d
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'), X# o! M3 M# q* q5 a
if (iedom){6 ^0 d3 Q3 A9 Z$ v5 @
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
4 f( t% Q* [3 u" h6 B- mwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')6 g5 Q( Q, {- ^# F! ^' r# \
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')' T$ t! @* H" q0 X/ V
write('</div>')
8 y( ^) C# e+ g. `& ~9 U}; S8 W- ~5 e3 D* u$ r! ^6 \) M
else if (document.layers){
- ?# `5 B; I+ q+ c; G o! `) kwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')5 v$ I. b. ?' N5 Q* ^1 L. u( a( c
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')- o9 X: m5 N3 W$ K& }0 ]* M' o
write('</ilayer>')
G3 H3 ^! N$ ]7 y}
3 m8 |# {8 r2 Z4 Sdocument.write('</td></table>')- t6 M: z2 O( d5 a- Q
}) H% v \# e7 G# y
}
, @9 g' ~4 r: l! s7 t</script> |
|