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

|
网页之跑马灯文字特效
//修改宽度" w" U* O+ X2 t) m5 S6 L/ q; X7 [% R
var marqueewidth=300) x, y' c# B, `& d0 I) X& I( G/ ]" _* I' M
//高度
+ f) J4 W3 T5 r3 xvar marqueeheight=25# ~" |: _" ~$ g% h+ l8 L
//速度(1-10) z0 M6 x, B7 H! J8 m) {
var marqueespeed=3
4 ]: S: b4 [' y//背景颜色+ q4 ~+ V& W7 g6 R
var marqueebgcolor="#FFFFFF"9 U4 p2 r8 T/ L6 T
//是否能暂停 (0=no. 1=yes)?" F7 Y1 ^) k. L/ L! [& ?$ ?
var pauseit=1
. R, q2 _0 V1 F" X/ N r2 |) R; A9 f
//修改显示内容/ {' o9 v m. Q/ B- X
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
4 ~' S6 j' F, Y P' X
# l% T1 G3 q6 M8 K2 F
+ s o0 D2 m* O) A4 i9 J////下面不需改变////////////2 I9 J/ I$ g) k: w2 h( H" z9 `+ @
7 j( ~0 \8 \' j9 h6 T
var copyspeed=marqueespeed
' F1 T+ w/ L9 O$ l! Yvar pausespeed=(pauseit==0)? copyspeed: 05 [3 `9 r5 N7 R0 M. v
var iedom=document.all||document.getElementById
4 R% C) V5 Z, b: H1 |( m& L( Z9 aif (iedom), g5 }& M5 E; M* c5 R; [; q
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
( f; w/ ^& y" h2 D `var actualwidth=''
3 G& x% I7 t( M4 D' T$ r, @4 ~0 avar cross_marquee, ns_marquee
, }( V$ H# K+ S8 D
, s- I# h( J' v. W+ sfunction populate(){- w6 l3 w; F: L
if (iedom){
+ o% z, ]2 |" g5 ucross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
0 I$ B/ l! F# o( X" j1 jcross_marquee.style.left=marqueewidth+8
) _0 P$ D; x' `% j: D: {cross_marquee.innerHTML=marqueecontent
/ Z7 c% K8 \5 m- V4 n" S2 w4 oactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
$ n4 V* U7 g8 M) B& w}- D* W5 T8 K3 U* Y
else if (document.layers){
2 l4 J" n+ f, t+ k( x" d) p. _' Ins_marquee=document.ns_marquee.document.ns_marquee2
! Q- f' G6 u( O0 `) @/ f! l4 kns_marquee.left=marqueewidth+8- {/ m% |" ^) {$ f8 n
ns_marquee.document.write(marqueecontent)1 k$ l" |4 r4 l; m$ S6 E5 N( A2 v
ns_marquee.document.close()
$ |, A' D+ B# G. Eactualwidth=ns_marquee.document.width
2 G, [8 s' l# N5 }5 [+ J}! `) Q' B6 t) g+ ]( {4 h
lefttime=setInterval("scrollmarquee()",20)8 s* K5 u: D2 j8 \' C% M
}4 P7 m/ q3 }+ O( K9 L. \+ G( t
window.onload=populate
1 ?, N. w5 w6 D3 K7 k n2 |2 x( D0 c. w" s
function scrollmarquee(){
- Z4 N; g$ a7 Rif (iedom){+ b5 q1 k& B5 K
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)): O& |5 m3 U- Y9 E
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
* ~1 t/ _$ d! x" r9 ~- O7 K. xelse
( I; C$ j' x# b* c q4 s* Ncross_marquee.style.left=marqueewidth+8- i& Q7 j7 J# k1 D
, }5 O6 g. \ B( G5 P8 g* D}
2 g0 i; L" x5 c& X" c% ]4 j' K+ Nelse if (document.layers){
! N$ o4 @- V; S6 n" _7 d4 Eif (ns_marquee.left>(actualwidth*(-1)+8))
1 O" N" f1 t& y( rns_marquee.left-=copyspeed
$ U9 t8 J* r* f" o* a. _. Nelse
E2 z8 S3 H. s) |ns_marquee.left=marqueewidth+8
0 A |/ o' n! P# h5 `}; w% K* S' V2 F" | |: ]
}
/ r6 Y; w4 ? }6 S! g1 n* i7 h: q6 a( P
if (iedom||document.layers){3 Y! M9 B$ x; u% k4 I
with (document){
* c# L- U% a& m) U A( p1 z- Fdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
' Y4 ?& C6 k4 p% [; G' X# pif (iedom){
( {" o" D% N0 b/ D( S0 _: kwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
, v0 \4 U c; _7 n# V& e$ Dwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
- J1 Q$ a% f$ { D2 dwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
+ }. g+ L8 H) Nwrite('</div>')
+ F; A/ s y) V}
4 t; M) x* O" H0 f1 e8 a( m9 Zelse if (document.layers){" X c- C" H& P: @0 T) y
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
! H+ n) r- C& E' i/ L3 A$ ^2 |* _' uwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')/ N# \& f) s/ c4 ^ \6 B
write('</ilayer>')
|/ }. {% m$ w/ d) ^( H+ L2 t. c% d}$ H. G" P9 e+ d' ]6 w
document.write('</td></table>'); r- Z4 b) H5 E7 {
}
2 V$ u$ Y( N! Q0 ~0 f |3 }" G4 p}
, C1 K+ [4 m& w. \; J% B) ?/ X5 e</script> |
|