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

|
网页之跑马灯文字特效
//修改宽度
0 U) T. k4 K+ w- r: ^- Cvar marqueewidth=300+ p! ^/ P# y! l D: `% p
//高度3 w3 W5 x, X# ~5 j+ g+ B. |
var marqueeheight=25
8 m8 N) m. C& V//速度(1-10)# T- j$ O2 V, p$ k
var marqueespeed=3
3 ]3 F0 r$ m2 o0 \1 k//背景颜色# }' |/ y ~ R9 q7 w$ x8 T
var marqueebgcolor="#FFFFFF"
[6 O+ ]) n2 v( I. n; }//是否能暂停 (0=no. 1=yes)?
8 k( U5 M6 B( J3 d" d7 ~0 _var pauseit=18 ]7 z7 T& o) z1 i3 Q' |( f- B; W
$ I1 x% O% r/ ]: W# |) s//修改显示内容( P+ m: `+ t d3 y& U3 D/ S% B
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
F( g) q3 A& r" R! }9 d( @- F7 ]1 A: p, b- V# D' [9 t' E
" x! O- K. a7 i3 s4 z5 d q
////下面不需改变////////////
2 i& q" g: v* }0 Z! S+ X1 x+ e! N1 {0 u5 {2 E* O7 w; F( Q% N
var copyspeed=marqueespeed
& Z( @8 p6 J' nvar pausespeed=(pauseit==0)? copyspeed: 0
1 V! D0 I; z5 Dvar iedom=document.all||document.getElementById& j1 `( s* U0 ~, x
if (iedom)3 ?5 N' ?' o+ y$ @6 Y4 L
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
1 D3 R% V6 p2 Z- Ivar actualwidth=''! z, b, R+ T& x( F0 s
var cross_marquee, ns_marquee
- `! w" l9 w0 d9 C L* K" e' ~1 z& u }- n+ w! [8 u
function populate(){; H* f* Z1 x$ l3 \
if (iedom){
: S! i- o( c5 \3 V) W2 n6 [9 ocross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
7 s) t0 F4 ?2 Z& Ccross_marquee.style.left=marqueewidth+8
2 I3 Z3 I1 ~7 O' Wcross_marquee.innerHTML=marqueecontent) L# K9 }- u' i2 m6 U
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
2 s: Z' ]9 {2 |" y Y2 d}* L, U0 R+ c c/ l0 b, |
else if (document.layers){
- u2 f3 ^, O0 G2 ^% d8 |ns_marquee=document.ns_marquee.document.ns_marquee2; s: c# F' L9 I8 F: o$ k7 `6 r
ns_marquee.left=marqueewidth+8
( d \# O% Z, s ?. b8 [4 O* V, ens_marquee.document.write(marqueecontent)5 J9 N; a A* m5 \
ns_marquee.document.close()
% T/ D; m+ n- Q- P X7 xactualwidth=ns_marquee.document.width j7 |/ A4 M4 ?, M9 j
}
7 Q+ v( u3 ]2 ~; llefttime=setInterval("scrollmarquee()",20)/ w) S' n+ p" g' e7 u; `
} }! q- J9 c! w9 H/ Z
window.onload=populate
7 \$ [6 u1 ^- O" L6 J
+ s" ]: E9 ^* C- ?+ Ffunction scrollmarquee(){7 O; `; D7 N" g& I
if (iedom){
& N3 [& n! l$ g# xif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))# r4 c; H$ h# N# t7 l5 R, j
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed$ B1 g2 s* ~# i3 m2 S
else6 Q/ T7 E, K K$ r% {2 B1 {
cross_marquee.style.left=marqueewidth+85 J+ O0 O; S0 F4 f K9 N, c* V8 [8 ?9 C
6 u3 R6 T/ s: ?: x' n, O4 C
}
2 v/ ?! n; y- H2 x2 g' Qelse if (document.layers){
. |. [9 y+ N" Nif (ns_marquee.left>(actualwidth*(-1)+8))
' T! x8 f- i ^/ cns_marquee.left-=copyspeed
5 J% t2 \. { V1 selse5 u2 X2 h+ `0 ?$ Z; V9 O
ns_marquee.left=marqueewidth+8* k- p) `- e5 \3 c1 }4 |
}
4 S* }- B* L4 d$ m8 h}) X( w1 B; A% r& t5 d+ e: J& H
3 k7 M$ }/ b# m, n% Vif (iedom||document.layers){
/ d5 z A( l. [0 X0 Gwith (document){0 S/ g' X- p" ?& O8 b, |5 C
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
2 G; N! q% z# B" Hif (iedom){+ P+ a7 R- _! N, q Z
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
8 N6 l! v% i O) Kwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'): U5 }6 L7 M( W: {3 Z& m
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
, V1 m) \( ~6 \write('</div>')/ N& [# |. n6 M3 H9 G, w' j0 R+ |
}8 ?. `) K7 v1 d- ] k
else if (document.layers){. p7 D# A3 X ^3 N, N
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
' B. s @- f) C q' J# L Dwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
' i# i* M5 l+ f1 y/ O8 o( Qwrite('</ilayer>')
4 y# r' ?4 V( {/ h8 g X- p}: E* N% M) X9 p z& m
document.write('</td></table>')
9 n* C |- ^3 h+ V}8 {3 R7 ~( z6 M' V
}
; A. V! m) G. H7 X0 n- V( v</script> |
|