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

|
网页之跑马灯文字特效
//修改宽度 u0 p) a+ u+ Q7 N; f% f
var marqueewidth=300 E2 V) V: N+ u( c& o2 _ {
//高度
4 D: P- H5 O% A. Z' H/ Nvar marqueeheight=25
+ ]- x8 ^( l/ J' N0 M//速度(1-10)! y* i7 l+ F. P8 n7 D. ? ~
var marqueespeed=3
8 z3 r& s6 ?0 m- R7 p) H//背景颜色
% D# t8 p" X/ W. f3 Pvar marqueebgcolor="#FFFFFF" y4 d, u& D: j5 X a1 N. n8 e
//是否能暂停 (0=no. 1=yes)?
9 g* N* D* b0 t* i5 c; A6 evar pauseit=1
9 ^# g! h" \0 T$ v3 A; z
' V* a' D' ]6 T$ j/ O& R0 f$ Q! Y0 J//修改显示内容
" d: V4 z* [! S2 B* q- H# Pvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
) M6 }2 p7 }) F; d, Y" x+ V; P5 G2 Y( @3 c
! |, L9 m8 y" T- W
////下面不需改变////////////6 X0 Z5 z7 [+ Q
4 a6 m r ]+ E
var copyspeed=marqueespeed
1 { n/ L: B9 O2 e& Y. Rvar pausespeed=(pauseit==0)? copyspeed: 0
9 _2 q7 ]3 M# q5 q8 ^var iedom=document.all||document.getElementById
' B. e8 U1 h* G8 X: K) {if (iedom)+ u! j0 z/ n3 F, B. d1 d# u
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
. o G( o$ V/ l5 y+ v! Hvar actualwidth=''$ e% z0 P6 }" z/ }5 j
var cross_marquee, ns_marquee
6 S- v. h. I; ~2 w* g; b3 ~/ J
/ d7 w3 j2 Y& h. [function populate(){
8 ]* v! b3 i, P5 ~if (iedom){$ V E& a" I! l) k+ q
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee8 s8 Z; R. H4 q( G+ r/ _3 c+ }
cross_marquee.style.left=marqueewidth+8
6 L: x1 t: p" a" P' ]cross_marquee.innerHTML=marqueecontent7 f1 d( Q4 |' \* z- e
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
+ {2 ~" m$ L1 r: g2 I; H}8 \" I' ?- l6 T) q
else if (document.layers){
2 p& ~2 r( L; lns_marquee=document.ns_marquee.document.ns_marquee2
$ ^: C- W3 h) v- C6 c% u" `ns_marquee.left=marqueewidth+87 z- `- N/ t8 H
ns_marquee.document.write(marqueecontent)
9 _1 v: R" u: z7 \3 s4 R& ]ns_marquee.document.close(): h( w/ \% r0 N/ q e/ b
actualwidth=ns_marquee.document.width
- @6 f# [3 p" {/ @( }0 d$ H}" I* _: V4 o" t
lefttime=setInterval("scrollmarquee()",20)
1 W/ h \5 l7 Y' I2 C0 P}
3 q8 [# }1 n1 D3 D. x! V! kwindow.onload=populate
" J. _# r0 ~3 j9 J) l6 ^# P1 I# { ~- W) |
function scrollmarquee(){+ x" }" G3 O1 T2 A2 h% w0 s4 a
if (iedom){
, y. `! L5 U; T5 J1 mif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
: `3 |; e+ T! q/ Jcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
& c/ |# x9 E, w J8 _( o* relse
+ e2 K6 t5 H% Ocross_marquee.style.left=marqueewidth+8
( b8 q8 e" g% z v l9 K4 p6 ~- F6 H3 [
}* t0 f2 X" V8 ]4 K
else if (document.layers){3 ~/ e2 y4 h6 {/ @
if (ns_marquee.left>(actualwidth*(-1)+8))5 V e- g" L* l" `7 ~$ c8 j* A8 P% i
ns_marquee.left-=copyspeed
6 C3 x4 t4 E# `4 ^% c) L6 Qelse
& v$ `5 K: q5 X( k7 ]4 c( gns_marquee.left=marqueewidth+8; o9 W6 ~( z& r' {+ t
}0 v, X+ ? P3 n9 O- P( }( x
}$ ^. N4 q! h" i% W
) A6 ^8 U4 P1 C" n- e1 B: N4 b0 k) a+ @if (iedom||document.layers){ e, Z5 N8 W$ f. t* J7 |" k
with (document){
3 \1 u$ U: m& P5 udocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')% W- [0 `5 I8 y8 }
if (iedom){
/ E# x0 P2 {4 b5 D+ Nwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')7 p V8 j) x. Y6 J. G
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
9 Q; E2 V1 G+ s! q+ Mwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')- ~7 C# G; E( B1 A9 ]- J
write('</div>')
$ {$ j8 J; K% `% D! R}
* j" |3 D. K' d0 Eelse if (document.layers){
+ P- n6 F5 Y, q6 ^ H( lwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
. r* a) }5 x" v3 rwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')5 c6 q' V. |( I2 _2 R. M0 N
write('</ilayer>')
]! s) U L7 }" V0 r}
, H$ n/ D. F8 j* e$ [- v3 hdocument.write('</td></table>')% L& ^) R; w; } K4 m$ E* D) ]
}
& j5 W, z. z7 I, y% s- } x: @) I8 y}+ H5 a# c+ B4 P& m: Y4 c* }
</script> |
|