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

|
网页之跑马灯文字特效
//修改宽度
l0 t% W7 O8 @6 ]. c; ^var marqueewidth=300
3 N! F* \* O0 E5 q; z/ T7 w//高度1 k4 t* b' e% A( z0 A5 Q. n
var marqueeheight=258 k2 K& G0 l0 s7 P4 [
//速度(1-10)
5 U3 m. t( w: v: B2 w. t% Xvar marqueespeed=38 o( N* R# J1 i* |
//背景颜色
2 s; w# O& Z4 a/ S: uvar marqueebgcolor="#FFFFFF"
/ |0 l1 e* ?' A( v! Y: d//是否能暂停 (0=no. 1=yes)?
) t' m; v6 t4 ?4 J2 n" q5 tvar pauseit=1) x( O& ^# T2 C4 y C
e* @8 c& E7 q" j0 y- j//修改显示内容
/ ]1 W3 E# e5 V7 Hvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'9 [0 e1 J ]6 I S
, ^- n/ T( e% r9 I
: z; U6 d: ^& b
////下面不需改变////////////+ A) A4 S4 |4 ~! S3 g% z) U$ Z
& [3 O! G# U; C6 x+ v1 B1 d6 }4 s: n
var copyspeed=marqueespeed
% j) q/ z/ n# J0 F' Q% I+ \var pausespeed=(pauseit==0)? copyspeed: 04 G: a2 E" s3 N/ r
var iedom=document.all||document.getElementById8 w5 j3 T' T) v
if (iedom)+ q6 O9 d" v: N! W
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
" I @3 S3 O& o# yvar actualwidth=''$ Y; R, C8 {: R, O& s3 O
var cross_marquee, ns_marquee
, T; R0 U% G0 k' `: q/ U
9 V: o: c: x" wfunction populate(){8 \" [+ E( P) f
if (iedom){- o- E) j. ^. ?2 F; N- r' c8 P) s3 f
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
" T7 F: i q6 h4 [/ Ecross_marquee.style.left=marqueewidth+8! x/ m) M/ W' }! a, ]
cross_marquee.innerHTML=marqueecontent/ D, u6 _' t' j* w. \' x' k
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth: G1 }" s$ x7 @
}
; s- m: G# P- w% P# [else if (document.layers){
+ Y3 e0 Y6 {" z0 i- fns_marquee=document.ns_marquee.document.ns_marquee2
5 K, Q& z- l7 G4 O# p( ~2 wns_marquee.left=marqueewidth+8/ h( Y: ~6 ?' o* \
ns_marquee.document.write(marqueecontent)
4 }3 x' C3 G+ U* z# T: `- ]4 Dns_marquee.document.close()4 F7 _4 M+ T. r* z( v% w. D* o
actualwidth=ns_marquee.document.width( X% v* N$ @& \( C5 F5 `
}
4 q0 X/ S1 }+ q- d( z5 V5 y4 \' Tlefttime=setInterval("scrollmarquee()",20)* v% V; X6 A4 h% a, |4 P
}2 T" P) p2 e9 g7 x
window.onload=populate
% `8 X% e. }! Y# e& z, X) v" C* E4 L9 ~' k( Q' |# e
function scrollmarquee(){
8 P9 P* r6 \; r2 y: v/ X" I5 Kif (iedom){$ r! q3 k6 r/ j* i4 |; u
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))0 y7 @0 G! B+ c
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed# F) c' S/ k* P9 u8 C" p
else
; ?0 Z! t& {7 C% l3 x; E9 B Ccross_marquee.style.left=marqueewidth+8. h: m! G' y+ N+ g8 X
' B' H! t4 \* |$ b
}" L3 I0 P4 w* U5 d! @
else if (document.layers){% k% O# J7 k. b. _. n
if (ns_marquee.left>(actualwidth*(-1)+8))! {; ?' H. a9 ?
ns_marquee.left-=copyspeed
5 t% y8 \) [' h5 f% }else
* \. z# N; }# M! H. m" V: Zns_marquee.left=marqueewidth+8
3 u! w, J/ ]1 x}4 S8 \& ], n! L, \( |) N( I
}
) l4 w/ D* G1 b7 m7 `
. B E! M# ^( Y8 R6 O: |, cif (iedom||document.layers){
* i/ N( @1 @* f' twith (document){' o4 y4 s4 \5 f8 T4 ^
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
( q1 g, r6 z9 f# jif (iedom){" n, e" C4 }* p X8 I
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')+ B; |5 a. ~1 F0 @* K# O" R
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')1 |$ ^) E; y. E) h; _; `
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')3 y( K* P- x8 y5 \4 f, U' x: Y
write('</div>')' v2 K/ B0 z! N# l: _: l6 V D2 M8 m
}
! x3 u8 Q! X( L8 t) ^% q9 T! jelse if (document.layers){2 X# s5 F+ P- x5 I* L
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')3 A1 ]8 a6 [9 P/ |% B( P3 e- t
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')4 E ? Z& Q; U' T! i& z5 E! c
write('</ilayer>')' s. N# O7 P* `0 R
}
6 L" d3 o+ C9 d5 |$ l" G) Y+ \document.write('</td></table>')
1 B* R% l0 k9 O}) `8 \7 L: t$ M
}, O1 i7 P3 R9 T2 s
</script> |
|