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

|
网页之跑马灯文字特效
//修改宽度2 l, A% \! [7 ` X9 E
var marqueewidth=300( }: w$ K8 I# B% S* W
//高度
9 [, @. d. F7 G$ P; ]6 v) cvar marqueeheight=257 u3 f: S0 d. ^6 x; x$ A
//速度(1-10)
0 |. E% Q! ^+ Uvar marqueespeed=3
" M9 ~3 U$ ]+ E. w% {- _//背景颜色
0 _, U6 D$ F- a7 R; Avar marqueebgcolor="#FFFFFF"
% x+ k+ k; q e K+ `, A//是否能暂停 (0=no. 1=yes)?
1 s! m$ Z$ y" J% h/ Gvar pauseit=1
# d) _0 U9 j, i1 w8 i7 Q' Z9 s
' r8 D* |$ r4 F5 C" X- g2 K" q [//修改显示内容* C' i2 |6 y, ^. O
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
) z. F- j* `2 h; _" z* l8 ?
4 g! [9 O9 s3 j/ D+ O! \
$ o( Q T) b+ E, O& u////下面不需改变////////////! b: O4 \( \/ L `- Y9 P7 O: m
0 k' d# o% T- H; V% `% \
var copyspeed=marqueespeed
* ?. T$ y0 c- l+ d0 V5 Ovar pausespeed=(pauseit==0)? copyspeed: 0 ^) s1 { f6 b% i/ d! G! N
var iedom=document.all||document.getElementById8 X& q# n h/ t6 B7 A/ e
if (iedom)+ s7 q- Z/ K2 |6 }# Q
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
: l" t5 I Q$ {* I5 Y5 `1 Ovar actualwidth=''+ r, L$ ]2 T; ^- W `
var cross_marquee, ns_marquee
2 _. T1 r: _! j# z0 Z% V% ^ M% c8 ^2 e( b- q
function populate(){
$ B, k8 n3 n0 Q6 p3 Cif (iedom){$ N( |8 A" ^3 W" F0 J+ \
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
- j4 p! E) W) f5 Y6 C- Ncross_marquee.style.left=marqueewidth+83 A9 B! f) f7 G1 w
cross_marquee.innerHTML=marqueecontent. B& h4 ?0 l/ z8 h6 t8 s: B" a
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth U; S% e r8 M$ r
}
( K' |0 y% L1 j( jelse if (document.layers){& Q: [& B" |6 U# d' ]6 G& l1 I$ b
ns_marquee=document.ns_marquee.document.ns_marquee2$ {* T. {# f. p7 o: L* e8 M
ns_marquee.left=marqueewidth+83 l, d* X, |; d
ns_marquee.document.write(marqueecontent)
: ~3 ~& z6 ^. D# V( ~# Y! Yns_marquee.document.close()
! n2 S9 ^8 o$ [6 ^/ cactualwidth=ns_marquee.document.width$ e8 V6 t9 J. U6 [- `- a2 c' O
}4 @; @% E4 K, C: _( i5 A
lefttime=setInterval("scrollmarquee()",20)& E7 Z; `" I7 l G2 ]2 P
}5 y+ D+ H, E! F+ r7 i
window.onload=populate
! l8 k' W8 s$ t# ^3 ^" {9 J/ b8 d5 m( t
function scrollmarquee(){2 {* `/ g) P/ U* I
if (iedom){$ F6 h$ ^8 @2 e7 p
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))! n. ~: U/ g8 t5 I3 X# F7 U
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed7 G3 f7 k, ^" r, y. }9 c' O
else
. _* L4 }1 a! v- z3 fcross_marquee.style.left=marqueewidth+8. J9 J& v/ f* C$ w
z% a. N! r D$ V8 ^, m9 O}
4 K) a" E1 ]7 J# Z+ q Xelse if (document.layers){$ Z' i" \/ T8 [: M/ s6 B1 \
if (ns_marquee.left>(actualwidth*(-1)+8))
- Q/ }8 E2 i' Yns_marquee.left-=copyspeed
% d# _- @9 H8 T4 B( \! G! U( pelse5 Z6 D& m/ q' |8 @8 x6 r
ns_marquee.left=marqueewidth+83 c# T; k- y2 U- \8 F
}
! v: N) ]/ a9 j' j7 Q}
- c& |* ^ _% J8 u, X# e* A# J8 L) V2 K6 W1 E1 W- w/ ^
if (iedom||document.layers){
9 W) L3 [7 Y) l. {with (document){
6 t# ?& X# H+ S) p6 S* R N/ edocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
( y2 }. @ E+ y# b; Z2 P4 tif (iedom){
- T" [- S; k0 twrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')% b$ E/ T+ ]* _8 i' i
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'); N2 `: E n, _
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')# F$ P! c" A3 O
write('</div>')
. O: ~. l8 Y" I% l( Z2 n6 L5 o}
& A0 N! A9 T* `! Delse if (document.layers){
6 F9 t1 L8 x7 L- k8 ^write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')$ F+ z3 f9 h' D4 O% |
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')- P, W$ S2 S- U1 Q" R
write('</ilayer>')) d2 f7 }5 Q4 G( \% I8 h
}: s0 D% x/ x0 ?6 H
document.write('</td></table>')
$ P, _, i' N9 V7 |) x}
; g% J7 h8 N& h. B; |6 d! z}- A, K6 N+ S* g
</script> |
|