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

|
网页之跑马灯文字特效
//修改宽度' I. F3 [ J/ \1 f. J) g7 Q( N
var marqueewidth=300: C1 t& Z1 |5 Z0 |( m
//高度
, w/ R0 p9 R" o( ?3 i( dvar marqueeheight=252 R9 B% [& s# I; Q$ O$ U
//速度(1-10)( \# B f; Y- T( t
var marqueespeed=3' i$ y/ ]6 o) m7 p; Z N
//背景颜色
( D6 n) l `6 vvar marqueebgcolor="#FFFFFF"8 F: V# I9 u% |1 r
//是否能暂停 (0=no. 1=yes)?
" P# N0 t/ M6 e0 c) C* o0 Evar pauseit=1
% e% i0 d& a8 ?: h$ J/ d# M# b8 k5 p$ g0 A' `9 J9 m! r( p* C
//修改显示内容- J) F( @% c1 V! h
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'4 w/ i# w& N9 W4 J! U# h Z
* `! d1 D4 I8 b% Z2 N" c" M
: d. h3 s5 ^; t' p1 |////下面不需改变////////////
) t% `% L. r8 {5 }# l9 T3 T/ b
- M8 }8 p8 t" Q' i, evar copyspeed=marqueespeed
) i- g; Z. }2 T: D: r) f2 Q1 Xvar pausespeed=(pauseit==0)? copyspeed: 01 |" p$ L# ~, P4 M) k, Z
var iedom=document.all||document.getElementById
# |1 q4 h% w/ Z9 V! A9 bif (iedom)4 [7 r- d! r3 Y- D4 |
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')/ t8 ]2 F8 f4 P3 n3 d
var actualwidth=''+ s1 T' F8 s9 ]% Y
var cross_marquee, ns_marquee
8 y! T8 z3 I, `# r9 A0 h* M' Q% m
function populate(){! d5 a/ S! X9 [8 |0 i
if (iedom){; V! m: K2 F( A6 E) b* B5 Q
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
& P% N% y- c* j9 e- ?cross_marquee.style.left=marqueewidth+8
' k; B. ]: X+ `6 U9 wcross_marquee.innerHTML=marqueecontent
- R: O- K3 I$ Y1 o( S* iactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
/ ]2 s2 P. k8 @% p$ S3 d}
y2 T! ~8 D6 I$ L; J, celse if (document.layers){
/ e3 [ }+ l! W& \) y" U& ans_marquee=document.ns_marquee.document.ns_marquee2
4 H: \$ ^% V/ {" j& @- F" Ens_marquee.left=marqueewidth+8* P- K; N/ K" ]+ Y
ns_marquee.document.write(marqueecontent)
: ?) A0 d0 n, \* \; b- {ns_marquee.document.close()9 \ h5 i/ Q& K6 \0 F" [6 V) r+ K
actualwidth=ns_marquee.document.width
1 v: E- V: ]- |, p" T5 x3 G }}
8 ?0 W q. o3 K: tlefttime=setInterval("scrollmarquee()",20)
# U6 E [: q2 f. @" ~; \}
4 B! F) t9 o( }- K% P7 dwindow.onload=populate
# u8 q( S. v$ c3 w+ C7 X! Y0 L
$ d& e! d* l9 I) J% @2 c, @- [function scrollmarquee(){
/ Z6 h* z) g, F( Z: D% R, rif (iedom){* C/ @/ C) q+ O2 Z* @1 P& Z
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))8 T8 L8 f, B: c) o
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed- N4 C" s. [- Z
else, C- a7 V) j C: q1 H
cross_marquee.style.left=marqueewidth+8
( v: b+ ~( j( | T0 G3 d {# M/ K: B) X: [5 L
}
( l/ n9 x6 T( @4 l9 Zelse if (document.layers){4 s4 j6 n9 |1 W& m2 @" e* f% `
if (ns_marquee.left>(actualwidth*(-1)+8))9 f0 Y9 z! L p- x' P
ns_marquee.left-=copyspeed
) @6 L% Q5 W! t' S0 ielse, S- l( k5 i5 _- Y
ns_marquee.left=marqueewidth+8
, t! m" X4 `) N' K}
) i$ E; l/ k1 {1 M# o/ F2 [}
: v4 X6 C( x1 |. p( P( g6 _) [4 Y+ F1 c, Z [, |8 I
if (iedom||document.layers){1 L% e; j& Q" E5 I5 t- ^! N
with (document){* D/ W3 m) q8 _6 N
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')" }; [& X" w2 R+ s+ d# o
if (iedom){/ Y1 C/ |. J# ~
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')3 A( V7 ^0 a, I' l$ d
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')+ `% V* T' Y- s6 n5 C2 O2 g& {
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')1 B& a- u9 F& s; \$ o7 i+ i
write('</div>'). u0 H) M! Y% n
}# J( W0 R( }) G/ F7 B
else if (document.layers){* H4 L( }, _" i' W! [
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
- {( e4 k- E5 V0 Z* G( L+ } r+ Mwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')3 s: x5 \' e+ P7 m m$ g, m
write('</ilayer>')2 [0 O( E, n$ p- F- p9 w+ q
}( b8 A" j U$ _7 m9 F! @
document.write('</td></table>')3 \- a6 E! h# ^6 k
}; {6 E% t; `" [& ~4 Q# [
}6 h; t* N/ R2 c3 [1 Q
</script> |
|