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

|
网页之跑马灯文字特效
//修改宽度
# J y& D$ e! I+ b% q: _" kvar marqueewidth=3004 V1 V6 Y8 i. Y1 x# A0 O9 n
//高度! }3 ?. `2 t) E
var marqueeheight=25* w( ]# W8 L/ {0 B% f
//速度(1-10)
" c0 i8 ~$ N$ y2 |4 m. Mvar marqueespeed=3
! T/ S% S/ }" E0 s//背景颜色
1 y7 F* ~! P3 Z: }7 H ? ivar marqueebgcolor="#FFFFFF": B, f2 y2 Y( z( E
//是否能暂停 (0=no. 1=yes)?
- f* D6 d7 s5 R) [' w0 Vvar pauseit=1# ^9 H8 {# a- W P8 R8 f; N1 e- Y
8 b' y$ y6 l) o6 T, g+ y
//修改显示内容
6 {* z; w% i) e: t4 nvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'; E% U; X' t i
# S* s& ^ i! ~/ M' x
2 T: q( g/ d N2 P4 S////下面不需改变////////////7 W, D, P& W/ E$ I( @
/ ]+ c( v7 M( c3 ?" Kvar copyspeed=marqueespeed
Y: ^; p5 F# o% hvar pausespeed=(pauseit==0)? copyspeed: 01 {/ J' n* x6 ]" s/ S v6 X
var iedom=document.all||document.getElementById
- V$ l. q6 R" Lif (iedom)4 H0 |" G' f* `6 m
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
0 |' a5 e) t2 v$ Ovar actualwidth=''
2 h* k4 |& [3 t) i3 y9 v) Vvar cross_marquee, ns_marquee: i r. s' s& ^5 Z
2 Z6 A' R, j5 Ufunction populate(){
/ y b8 E) l. A: q# _* Uif (iedom){+ D6 J' G4 m/ ^8 t2 b
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee' Y) C# p4 P# ` w
cross_marquee.style.left=marqueewidth+87 Y U. a! ^6 }4 }" m" [% l4 i
cross_marquee.innerHTML=marqueecontent
6 k# m4 W% ^, v5 G- ]# N% Dactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth3 t$ S9 N& w# B* `3 [" w/ o7 `
}
- O9 ~( L7 k& j! ~; N+ V0 M9 c0 Eelse if (document.layers){# r1 n Z( L- l4 z+ I$ B7 a1 m
ns_marquee=document.ns_marquee.document.ns_marquee29 X' }$ V! H! C# p/ q" W
ns_marquee.left=marqueewidth+8, \8 J) ~+ l x. F! i
ns_marquee.document.write(marqueecontent)
4 o7 w8 y# |. D0 n$ m& gns_marquee.document.close()
0 W, e1 z5 ~/ s, j: |actualwidth=ns_marquee.document.width3 Y& h2 m/ f5 t% J: {
}4 K1 ^& G, ~1 _ Y' A8 {
lefttime=setInterval("scrollmarquee()",20)
0 x9 A* }) T& c1 x- {. t* S}
1 R' n0 l5 n" b, [$ C3 y8 I3 lwindow.onload=populate
" B/ S* o, ]: v% N0 `. g" J n# A' V7 B9 M
function scrollmarquee(){
( W6 w4 ~$ L' G; Iif (iedom){
( L2 T7 e N- ~* P b$ Hif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
& p: _ k; e; A' U8 q, R: Across_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed9 ?0 p5 M: n8 C6 G1 [/ h+ n
else
) Z$ H% `1 ]2 V9 i5 s8 jcross_marquee.style.left=marqueewidth+8* b, q- A' e) x1 w" z
C. c9 v3 @# a+ v}
3 `; c% F! q) pelse if (document.layers){4 W( o, K7 B" U+ [
if (ns_marquee.left>(actualwidth*(-1)+8))) J. g2 L! s% R, @+ K' T& K0 @) M
ns_marquee.left-=copyspeed
: l+ [( c7 \1 b' {: B8 R( f) Qelse) ~. T9 P; @+ q- _/ S4 ]. F0 d
ns_marquee.left=marqueewidth+8
' Q! a- i8 G8 x2 b: U2 {}
* X! G$ I& j& }) q3 s}: s% t8 V8 c L/ ?
) N7 G( H" G9 O
if (iedom||document.layers){5 w- E. Q' A# [1 W( h% L8 z/ Q
with (document){) V2 f" k+ j! c, h9 W
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')3 _' e/ V2 i4 m& C: a; l# p0 P
if (iedom){
0 @8 t5 O& L! v% w4 \ D% g, X' ^write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')* h) m8 T+ q* o8 r
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
( `; N! ]7 @1 O/ B3 `& jwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')/ Z0 R1 s; ~1 ]" M m' N8 d/ `$ v
write('</div>')
: @% D! |) j. H4 d6 I}
$ v' ^& ^$ J; o4 N0 {else if (document.layers){$ d f- b0 i- k" z9 |& Q2 X/ j
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
9 _( b+ n/ P0 R9 bwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')4 O5 k# n+ o+ s2 n- `- L
write('</ilayer>')& X! D2 e1 g+ \/ |6 a
}
$ n: I# r: J9 q$ U' Tdocument.write('</td></table>')' B- s& a6 B* r; Q& t, V
}% j" R) i) H3 w! T3 ^( ?
}; G' N- ?; h) U( |- Q* K; C, Q. p5 ^0 J6 O
</script> |
|