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

|
网页之跑马灯文字特效
//修改宽度" \! L& B/ Z. q
var marqueewidth=300) s) [4 ?# k# F
//高度8 o# Z$ s; _3 j) B1 ?% u- Q
var marqueeheight=25
. F0 j! m4 Q F9 }7 l/ c//速度(1-10)
( v9 `! E8 n( h* D, l# i% Qvar marqueespeed=3* _) M1 Y( B, z% O; K$ O* q5 p
//背景颜色0 ?, I0 m1 j3 x! W, A( |
var marqueebgcolor="#FFFFFF"
4 h8 E! L" `$ h* C$ i//是否能暂停 (0=no. 1=yes)?
9 {$ O4 G2 R( ]& h6 T* mvar pauseit=16 E& k9 z: w% s# u9 W4 i
9 V: C, y; |& j//修改显示内容9 w' {0 H( J5 N: R$ R
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
/ |- d; Q, R+ e5 o5 c2 t8 e& n' I0 O c5 |/ M7 _0 X- ~; a" [7 _; r* y4 G1 s& i
( e/ ~- d0 q& X: F. L$ |* w9 X
////下面不需改变////////////
/ t2 B( f! ]$ E7 x9 j' ?8 d
9 H2 c: Q" O. }" i+ {/ Svar copyspeed=marqueespeed
# |3 G. d; M1 s& e1 Z4 m) gvar pausespeed=(pauseit==0)? copyspeed: 0( A2 {1 c2 P7 |( h- I- ]
var iedom=document.all||document.getElementById
' H8 h* N; K+ M; G* u: Aif (iedom)
6 J- p+ v( R' t: f9 J3 idocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')% e: C; Y @; W
var actualwidth=''3 c7 ^% J& B# K' A3 f
var cross_marquee, ns_marquee5 R4 b3 J: M+ ~2 U: g
0 S7 T1 B& _4 J& U# [/ h( |2 p
function populate(){0 ^7 n6 P; N/ k3 z! H8 v
if (iedom){8 I* G3 P' ~. X: V- Z5 A
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee0 I4 [ V0 _ N5 h) G
cross_marquee.style.left=marqueewidth+89 J: y# j6 S1 z8 f2 k0 w g/ N8 S% z
cross_marquee.innerHTML=marqueecontent
# S* O/ W& c# }- R# v5 sactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
7 h) H! M8 R3 O}# _0 |8 y% R: |6 |7 n
else if (document.layers){# n7 `3 b+ D4 b1 H, Y
ns_marquee=document.ns_marquee.document.ns_marquee2
: }& |8 Y' V* Ens_marquee.left=marqueewidth+88 _, [* L& t1 A! N* g
ns_marquee.document.write(marqueecontent)
4 X- ~4 N6 m' P9 W5 a' }ns_marquee.document.close()
( M% }2 P& n, L- J @& |7 G) Cactualwidth=ns_marquee.document.width$ {+ z9 x% x: Q) a
}. }- e @ U* h; ~) n7 o
lefttime=setInterval("scrollmarquee()",20)- W$ w% Q6 z/ f+ q
}1 P6 l( t3 Q5 Q5 H8 ]9 H
window.onload=populate; m. ^5 D9 I. Z+ n
) t1 r# o0 D* c) T3 u, m% t$ m
function scrollmarquee(){! b3 d4 Z" |# n. G9 Q
if (iedom){- b6 i5 g9 j q9 C( @. |, n5 J
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
+ r8 `3 a& n; V Lcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed7 O- [) t; g/ V
else' u# y& Q9 f, T! V6 ?4 q; f
cross_marquee.style.left=marqueewidth+8
* `! ?1 d5 Z, G9 J5 ^4 P$ C
2 \ h ` F4 p7 S: _% W) j}1 u6 z7 c: s/ R* y; c# z1 Y- [
else if (document.layers){; ^5 N' l' T' V1 c
if (ns_marquee.left>(actualwidth*(-1)+8))
0 s# T# v$ s% O% Fns_marquee.left-=copyspeed# Z: y" t: ~7 i6 c' W- q7 o
else l; G7 K$ M: @* k% d
ns_marquee.left=marqueewidth+8( ` H5 B1 m4 r9 D) J
}' B2 ~4 A. g7 Q* z: f! O
}& C% r0 g5 x# L, ~3 T
* k- ^) y- o. ~" V! e! Xif (iedom||document.layers){
/ g. G- m" y3 r2 B1 V* \1 swith (document){8 b/ P: |# G- X5 w, W- L& { O
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'), ?# {$ v; m G: F
if (iedom){- S' A% F; ~" G+ a& \ o; W
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
' ?- {0 e; z* }- o8 u- ewrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'): s) W4 _' i/ _& W6 {* c
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'). R# { j7 Q6 f& f, s& N8 p# J% T
write('</div>')* j, g' r0 C& v) I
}
$ n5 [, \$ x! R% l, k' uelse if (document.layers){- `( Q T" ^' V9 L
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'): U C7 r- t7 G1 |7 a6 j
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')$ T. A- L4 _; X1 m' I: |
write('</ilayer>')
/ p2 X8 g. P3 Q3 i, H O}
$ u! n* ^; v" W, ^' g5 U) p) ddocument.write('</td></table>')' d4 W% e: @0 k" T
}5 W0 [- v1 s% y o
} ]- J: W8 c: `/ V+ T" o2 t- r
</script> |
|