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

|
网页之跑马灯文字特效
//修改宽度! _7 \% l t8 z& {. { w
var marqueewidth=300* K$ P, \( {2 z3 E8 L
//高度
; G; a) w, H% _ h$ vvar marqueeheight=256 \+ H7 Z+ t: d8 n( o3 L
//速度(1-10); Z, [2 J# e ~/ r! ^
var marqueespeed=3
' W7 r9 N' |- s* g" t//背景颜色( X" S+ b) r$ c! J$ }0 C' O* Y
var marqueebgcolor="#FFFFFF"
9 d- ~! k+ `# H: p//是否能暂停 (0=no. 1=yes)?* s9 n0 R( e8 C8 G
var pauseit=1
( w& h; w0 O2 h6 y5 L q8 O. Z( ~0 h# f
//修改显示内容
4 J/ b- x: X5 Z4 Uvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'# s8 k) T# s9 C0 G2 P6 l! ^
/ {8 L8 q5 E0 b4 c
) [" W, \- }8 q////下面不需改变////////////
, M3 u$ u" F' I6 K6 N( Q+ H5 v6 B: u1 T
var copyspeed=marqueespeed
1 B0 f& @( Y: |5 {9 bvar pausespeed=(pauseit==0)? copyspeed: 0
) t! k* C& k) X. Svar iedom=document.all||document.getElementById1 K7 V) o% N9 R9 ^3 w; C- X6 _
if (iedom)+ c/ k3 O/ \' y, o1 X
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
; D, B. Z4 j* J; X! e6 w+ P1 M+ ?var actualwidth=''
- v5 P9 y9 m) v1 N8 Ivar cross_marquee, ns_marquee
/ }% F- r& f6 i: {4 S' I0 D5 X7 V3 b& S4 L3 G( w( E
function populate(){* h- Q' q; M* G8 |: M, @0 h
if (iedom){2 R; v. ~# G+ m' Y
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee5 J" i& j5 K2 ?: d$ T! L
cross_marquee.style.left=marqueewidth+8
7 a' @* O; S0 U" mcross_marquee.innerHTML=marqueecontent* l* H( R2 _0 G, H s4 v
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
8 ]$ S; A3 X+ @5 X}7 |2 S0 ~; V4 k" M3 a
else if (document.layers){
8 u8 d: j3 N$ H5 s4 l7 |7 fns_marquee=document.ns_marquee.document.ns_marquee2
( k* R0 n5 U$ [$ P' X- ?ns_marquee.left=marqueewidth+8
( \5 e3 K7 J3 s4 `* d. \ns_marquee.document.write(marqueecontent)
" R9 i9 a) X( bns_marquee.document.close()
! {% @- r# w4 mactualwidth=ns_marquee.document.width3 c+ w* U4 \- z, h. G9 O) o- x
}7 q/ \- R) [7 H$ M) [0 D
lefttime=setInterval("scrollmarquee()",20)
3 O( [/ X- X) k}/ c Y# J! n, z4 ]/ L
window.onload=populate
' t! a; ^! F K8 d( ~& n" \
4 H! R( t1 o0 {2 x: Hfunction scrollmarquee(){
5 K0 E+ M W* c0 E* n) z* lif (iedom){
2 i' K% `+ r2 e! D" e Qif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))& K! C! E9 |& @/ N& G
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed( V6 x! u- ?; p$ A' ^6 `
else
`* @4 X0 p% I/ |* \cross_marquee.style.left=marqueewidth+8, m% [: l+ F1 c% U0 p' L9 \% ~# \+ }
$ A" {9 N& {9 J
}
/ y& |6 i( E- }. Xelse if (document.layers){. w- }) s4 w0 N1 s; U
if (ns_marquee.left>(actualwidth*(-1)+8))7 l7 W1 T+ c# ~3 l u
ns_marquee.left-=copyspeed1 J; S5 _0 q8 b) Y4 F# k" {; [( Q. P' D
else1 s/ `% J7 ~4 Z. c5 G$ Z# W9 W
ns_marquee.left=marqueewidth+8& V/ ?2 z, ]: ]7 J9 ~1 O6 @
}
! C+ N# G8 u9 f4 O+ G" d}. [( K, m3 I3 g. o5 L& y: f9 f% ?
% f2 W) n4 k! s0 Z, q5 F* Nif (iedom||document.layers){
7 e8 j0 i8 E2 A, i, z: y" [1 iwith (document){6 w7 j8 x, Q$ i
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')- f0 L, ~ @ j3 a
if (iedom){
2 ]+ k- _; I- T' v. Z2 C* Awrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
" f8 X8 J c" K5 h( ~7 Ewrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'). w* p' T3 s! d+ W' `; O5 I
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')- {7 P& Y- b; Q) O0 H; U$ i1 [
write('</div>')
' h/ G% q& _. G9 [' S0 Y3 t}
( {$ F2 z1 `' W: h f/ qelse if (document.layers){0 X# U4 N0 x2 |9 h/ h G
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')- I+ V9 t2 @' `* {
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
7 v V, h1 Z3 ?$ _write('</ilayer>')6 r7 I7 Q( E0 \+ u q
}- G: Z ^; N9 W. F
document.write('</td></table>')& G3 O2 ~+ L% q1 n% N2 f) r$ p2 M; C
}6 o2 ?5 B4 }; j+ r4 K8 l+ k- M
}" b: r* j, G- y5 }1 @
</script> |
|