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

|
网页之跑马灯文字特效
//修改宽度
9 R0 ]+ L0 B$ x# |: ?0 _ Q# n bvar marqueewidth=3006 Z- p) h" E& g) a8 D' M$ ^. r
//高度7 | x/ F* J& j5 q' K5 i% z
var marqueeheight=252 _: X, ^6 X) O8 j
//速度(1-10)$ E* f% j% u* s
var marqueespeed=3* ~) m. w5 [- b* |$ x. c
//背景颜色+ W2 V. E/ i' @' r l9 s0 K8 r& d- G
var marqueebgcolor="#FFFFFF"" s0 t9 P" Y! ]& s" [/ G: a( d
//是否能暂停 (0=no. 1=yes)?6 L, H. q- {3 N, v+ D
var pauseit=1
+ w% M5 \& b- ~4 X) Q- h2 o1 Z0 w: j& |3 v3 k6 d% q
//修改显示内容8 n+ g& A+ m( \5 D9 r0 D# h: c% z/ ]6 ]
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
4 H& g- Y' p+ X& M* |
! A+ f8 n% f6 y, |) Y' a2 @ i( ^- \2 ^' ]; B4 ~& A$ ?1 r
////下面不需改变////////////
. G* Z; V, n* K$ e! C
6 g g2 x7 P6 s( o& V7 mvar copyspeed=marqueespeed
& s8 y ?1 R# ?! o0 J' T Z7 Avar pausespeed=(pauseit==0)? copyspeed: 0
" c# j& x- W4 i# h; ^9 ]var iedom=document.all||document.getElementById
/ e. o) d( i* I M6 `if (iedom)
$ B5 M. |) E& Y1 B! x) Cdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
4 b+ i6 a2 |# Q* bvar actualwidth=''
# r8 g% }) q% m$ Bvar cross_marquee, ns_marquee' ?2 Q+ i8 g& m; u: D
' H; `( o) S1 b5 n
function populate(){ \1 _0 Q8 i" M; H9 Z" F6 c
if (iedom){
8 B T! k6 ~6 K4 |: Across_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
' {! Z3 V( t9 W' ycross_marquee.style.left=marqueewidth+8/ \7 G% v+ q$ f o) j9 E) w
cross_marquee.innerHTML=marqueecontent) l, c& k! a9 w$ E
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth# s1 Q3 r. _/ f. P2 A5 \% j' _
}' u% H1 Q* r/ J Q! R8 ^
else if (document.layers){
4 L+ R2 _" g) y! j8 c! r$ N4 qns_marquee=document.ns_marquee.document.ns_marquee2
0 V: B0 L+ i/ ^/ u* j8 S* x. r! tns_marquee.left=marqueewidth+8
' F+ M1 w! _8 |* }ns_marquee.document.write(marqueecontent)
! E" b3 k$ k+ \- P' r- @+ [. ]ns_marquee.document.close()) M9 E% ^1 }; u8 O& I& U
actualwidth=ns_marquee.document.width# X8 X* |1 q% O& k7 r+ k# X
}7 X% i ^7 o b! T, ~) Y& i
lefttime=setInterval("scrollmarquee()",20)
n$ w7 n- {& X) E k& F4 N# n, W}( x! e" C5 K# p2 ?$ E
window.onload=populate
4 n Y" {0 M N: E
4 Z. A% z' C. Zfunction scrollmarquee(){6 ~, F( R1 I M! n, `% {% h y
if (iedom){1 F$ P9 k9 I' G( p9 H% i7 q
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))' H( K! d7 T1 o% t& m
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
; ~/ \# D/ [ q, G% O# e/ _" c' ?: [& Nelse
+ I, } w/ `6 f: Q# L, z* Ecross_marquee.style.left=marqueewidth+8
5 U& c4 i' [# R; R$ \
: L& W' u2 k. L' a6 j: b; |2 `6 S}
/ |: j1 K* [0 d' v) s! Delse if (document.layers){: q i' s& j. \/ m! h1 z
if (ns_marquee.left>(actualwidth*(-1)+8))
! ~1 v# I! D! J! u3 h1 ?1 v' G" Yns_marquee.left-=copyspeed! M |- s) Z B8 e
else
* F+ w( r' m; s5 Y" l/ o( Ens_marquee.left=marqueewidth+8% O: L* }0 d. B0 A2 g" i8 X# O
}9 {* `* C, {, K* ?2 l8 g# I0 r
}& Y* M6 k' v% N' I( G! D
3 p' U0 C' X+ W z% ]6 Sif (iedom||document.layers){7 G& Y. r3 M% v
with (document){3 f z6 h1 Z' o2 V& ]
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
) d2 W2 C7 ]% W- eif (iedom){
( r$ Q6 ?5 T' A! b- w7 w/ ~write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')/ R! q# _: ~( L$ i/ z+ E
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')0 m% E- ^% W3 L( i
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
6 A1 l+ ?: I' { n' N: \write('</div>')4 [) {! K1 I- A9 c T$ X0 O
}
9 ~. S8 N4 ^" ~; m2 Y5 ~9 ielse if (document.layers){9 v+ B5 p: ~) G( k& K* w
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')5 {) L" J8 P" Y6 M9 U7 M0 U {, H
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
- w- w; k( b% }/ \# iwrite('</ilayer>')
( e" K7 e& O. u# y}/ t- a3 N6 d8 Y7 m( r) D! B; G
document.write('</td></table>') B; ` n( c" q
}
$ \6 F$ e, G& [, O# D- |}* K3 Q$ @3 A r" ]
</script> |
|