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

|
网页之跑马灯文字特效
//修改宽度
% ~7 L" [' k6 F$ T% C, f& \var marqueewidth=3008 c& v& o4 e. l
//高度1 @9 T8 X8 u9 A( O
var marqueeheight=25# ]3 D2 Z4 h6 t
//速度(1-10)8 ?# w! E A: d, X! |/ U
var marqueespeed=3" v: h9 v/ J% L1 t B: `
//背景颜色
: G# p' m, y" M. O( q; O0 Pvar marqueebgcolor="#FFFFFF"0 W* }% E2 f, f7 B6 R
//是否能暂停 (0=no. 1=yes)?8 d* y" d, M9 ^, @5 l& _
var pauseit=1
/ a! N: g% ]* C8 I& n$ m
2 {1 @: f+ f) o0 A4 Y0 b) [//修改显示内容) u; a9 |' ]0 s, Z! j4 t* B
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
6 o% O8 y9 j8 X: p
5 I9 Q' C8 |5 u0 e% ~: z/ A% M, j% Q1 N! k( N* \' _7 g
////下面不需改变////////////
8 c" s6 y S- i3 ? s: E2 f
. o! J6 d& u) ~+ r5 i2 Pvar copyspeed=marqueespeed8 H+ A1 b4 Y% ~2 M6 J. e! g) v
var pausespeed=(pauseit==0)? copyspeed: 0
* N b1 \6 J/ b# B! w6 ]var iedom=document.all||document.getElementById" E: \& h% P, e
if (iedom)3 M1 ?6 A! k$ m0 E
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
, W9 p" K" m* ^+ s% e/ s4 Z1 l4 Y4 e! Ivar actualwidth=''
; q" s% M* y2 u9 d- C$ H5 ivar cross_marquee, ns_marquee& J: L# \# {6 M F' n3 ^
' C& r) y% T. f* Q
function populate(){0 f0 C$ J, X, a
if (iedom){
5 h) J6 l- z2 j; {cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
* G* A( P8 G7 R' Bcross_marquee.style.left=marqueewidth+8
; q' n7 n3 w$ W, ccross_marquee.innerHTML=marqueecontent
7 f* U3 {; x. o1 G* L; S; ^, `actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth! @; _ h1 D: ?% @1 D- n
}
6 s8 z. k7 S I6 i' y' z+ r) z Aelse if (document.layers){
: m7 Z. k5 e/ w1 @ns_marquee=document.ns_marquee.document.ns_marquee22 d( F" w% b: V) A5 t& X% z r
ns_marquee.left=marqueewidth+8
: G2 T; p( X0 a4 c! k6 q3 rns_marquee.document.write(marqueecontent)
; W, w! I, i' ]. U& gns_marquee.document.close()
1 N- v- W+ r5 y# J9 Iactualwidth=ns_marquee.document.width+ l+ w+ L6 l% f
}0 `( P) p3 O! } ~
lefttime=setInterval("scrollmarquee()",20)
3 O' {1 |6 } X}
r, p+ d2 R! c4 ?+ Y& n6 lwindow.onload=populate
& t# i: x" g4 u N* t0 e4 k+ q6 s( Z& _$ r# P8 I
function scrollmarquee(){3 D9 Q! F1 F" p2 ?/ \5 l4 o# Z
if (iedom){
1 \( m- P7 g! L. z8 _! Bif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
% s2 P! N! C7 b" k; \cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed7 z4 U3 ]0 s) S! W F. X& n/ |
else
' ^$ V* {; G, U3 ucross_marquee.style.left=marqueewidth+84 N. T, M- Q/ e1 C. R
6 w4 a* M/ N9 [2 R8 G' v}
2 ]/ z0 E5 Y# M$ J- Celse if (document.layers){" s1 s/ C1 s8 M7 H5 _% C
if (ns_marquee.left>(actualwidth*(-1)+8)): L e# j2 O4 D5 S
ns_marquee.left-=copyspeed
$ s- b0 V8 ]2 f5 |else2 J, q. R; ~: ]+ j4 x7 \5 |
ns_marquee.left=marqueewidth+8) ], V/ M% P0 W- }3 ?7 w1 g9 N( h
}
: d/ P9 W2 E7 L}2 y1 ?6 K- ] y5 R0 @2 m e# S
. }: E3 [' Q! ], r+ q
if (iedom||document.layers){. {% Q' ]" V* a% V# G6 m
with (document){; S. u) z! V- z/ L; f4 A/ ?
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
" k8 ]* b7 u" Bif (iedom){
2 \. s i# i4 O# cwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
1 }; ^9 D* V1 t* ~: G, _9 z% _write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
j1 E S1 @+ K5 c, E- ?$ U2 Ewrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
& L3 W+ `, s: v! ^; `2 Wwrite('</div>')
' A9 b1 `" z9 u6 q9 X# F}
+ l5 m: W/ z9 E4 \else if (document.layers){
3 \! f$ q. i& m) {, Rwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
8 N i0 ^5 B8 y- l' ^/ Uwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')# c) ]9 c. B+ l; }$ u" z
write('</ilayer>')
; B7 x7 v6 u4 _} [. |0 Z1 M7 a4 `+ X0 L
document.write('</td></table>')
" R) X! A' N$ Q5 P# ?% e) v4 I}
' K1 V* @ m/ j$ g}
5 k4 `: d5 J' J1 _+ @2 q( H4 i- B</script> |
|