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

|
网页之跑马灯文字特效
//修改宽度% H1 X( G' ]9 |5 i1 ^& d- O
var marqueewidth=300
2 j6 X2 ]$ z5 d6 C# h( n. R//高度
9 Q0 o+ L! t$ c+ Lvar marqueeheight=25
# }; l7 ^1 ]; Y4 P//速度(1-10)7 j3 A" C7 i* X6 ]
var marqueespeed=3
0 I% P& P* K- z//背景颜色
2 f' m" y# X+ z4 L- Mvar marqueebgcolor="#FFFFFF"
2 ]) b& u6 k2 D$ f/ y6 K, o//是否能暂停 (0=no. 1=yes)?
6 z9 V6 r7 T: o! d( mvar pauseit=1# z. B9 I! \9 U
" f. @) O9 ~. q. h5 t& G
//修改显示内容
0 d# S+ k- K7 d, }var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
) Q& z1 x1 d& H6 E3 s3 [
- C H; n0 ]4 d( ~( c# r, K7 L0 T# f9 y$ X5 I
////下面不需改变////////////3 h" z0 q Q j1 T) U& y
/ G9 Z9 l( O0 z3 x8 I+ t2 ~var copyspeed=marqueespeed
3 U0 l5 ]) X9 Y# s# c+ Vvar pausespeed=(pauseit==0)? copyspeed: 0
5 t r& N$ D5 `3 Jvar iedom=document.all||document.getElementById
$ K) H$ t- W( x, X* N5 Rif (iedom)' Q# G I3 o. ^
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>') P" r: P/ g6 t; y6 C; t
var actualwidth=''
+ w3 O1 a: |3 `- ?0 tvar cross_marquee, ns_marquee# m% t G! [4 W. V$ R
y+ G( G2 V% u8 D* }5 U' jfunction populate(){
. H; F, o8 |5 {7 H3 O" Zif (iedom){
" F3 ~( {2 W1 N6 q% @cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
) f. P4 r% b& W# j" X+ v5 n2 icross_marquee.style.left=marqueewidth+8
) L" P( u: }; B! A! s. @cross_marquee.innerHTML=marqueecontent
4 |6 [0 D1 ]- P, Q6 g$ L+ N5 I, Eactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
. d- e$ P' S0 S/ O}* W, X- y6 U8 Y+ i8 I8 ~
else if (document.layers){
. a# ~- |, ?- @" ^4 ]& j) Ons_marquee=document.ns_marquee.document.ns_marquee2' N& d9 C+ @4 u% M N1 k
ns_marquee.left=marqueewidth+8% Q1 j1 j- w7 y9 y4 \5 U
ns_marquee.document.write(marqueecontent)" u% h- u4 P) J6 j. ^
ns_marquee.document.close()
5 [: A$ o( k" S# y+ o' ?actualwidth=ns_marquee.document.width; n& R7 Y1 |/ `6 X: x* \% a2 N
}
/ b5 f. H+ z& i: i( plefttime=setInterval("scrollmarquee()",20)
V( }- N* ?4 A# b* K9 v" T}8 h5 B+ @2 X' S$ ^
window.onload=populate9 G+ P. Q4 K9 ?" B8 k
% N7 q' a( ~$ D5 D! \& k
function scrollmarquee(){
' ^9 s' ?( M" D* h4 {& Tif (iedom){
7 _4 b0 N/ y! r+ hif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
8 w; N5 \+ J5 t! W, M j$ `+ x& Vcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed* O4 ^ @+ I7 q0 A& h9 g6 y
else! q2 |" B( l; F: `+ A
cross_marquee.style.left=marqueewidth+87 A0 q0 p( V# G9 D6 x; T5 S9 z
* \* J p( \$ N V% T
}! Y6 I* ]; ]# g4 ?: f7 O
else if (document.layers){% K1 y6 I' C8 `' d$ N1 R) x
if (ns_marquee.left>(actualwidth*(-1)+8))
4 j2 ?; o9 B ]: Cns_marquee.left-=copyspeed
( L2 F, t q/ v- k2 |else& G+ H1 e8 R% b; C
ns_marquee.left=marqueewidth+89 v% x9 @6 u, V0 k. ?
}
, N. C& [4 U6 C% M' r( n& B4 d( X$ N}6 Z$ B/ T! L! j7 R7 e
1 S0 M/ `& J& t: `9 p* Rif (iedom||document.layers){
' B' G# V: D2 Dwith (document){
; h# {6 P0 Z; O2 F( \% m. xdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')6 C! Z. W/ F, F P9 M/ g, i. `
if (iedom){+ B2 @, c0 S5 v( _* J8 |' i7 ?
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')2 Y$ P. d, X% l: c6 M
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
! t& Z; r7 }6 a9 z- z* dwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')+ s0 y: s; z, U$ S5 c/ L8 c
write('</div>')
3 u. i+ l9 H$ _% @% M L}; H% E' o) q) X' r
else if (document.layers){
1 ]! f9 T& g% C+ o awrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
! d F1 R4 T+ vwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'), L2 `. D. L9 D
write('</ilayer>')4 Q0 O5 @ S# A8 Y+ {4 _% y
}- W" n' a4 l! o7 O8 M5 G, Y" A2 `
document.write('</td></table>')
5 s. S4 A$ l9 ]2 @}
$ c7 F2 L" d/ x2 V: L7 V9 i: }}
M7 {0 I( A6 B: A* F2 ]</script> |
|