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

|
网页之跑马灯文字特效
//修改宽度
9 y: E+ a$ m7 {* r' Yvar marqueewidth=300
' a) g. v$ o; j/ I//高度0 y) Z8 f) g! X m7 ?
var marqueeheight=25- V* C- d1 X2 v5 a
//速度(1-10)0 S9 E! F* W' L& Y5 V
var marqueespeed=3
- n& {3 r- n6 t9 p9 i//背景颜色1 V. A% l7 `6 ]7 J6 c$ V) f5 V
var marqueebgcolor="#FFFFFF"
4 p+ o9 @% K+ {//是否能暂停 (0=no. 1=yes)?3 `% F" b1 C" p8 L1 \
var pauseit=1
8 n: p/ S9 U* m2 H3 H" g4 c' Z
: n2 | s+ w D8 O//修改显示内容& @7 s: A, u; o
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'3 j% e2 {: d$ Z: M$ i8 Z8 P
5 s& r- B0 o' I. ^3 f* T+ f6 y
- ~" L4 I) K- s) Q6 h# J////下面不需改变////////////: N1 x2 r3 k _* U: d. k
. q* ~, ]7 o6 b* a+ |6 l
var copyspeed=marqueespeed
8 C9 C' t5 H8 Z7 I2 m7 m6 u8 cvar pausespeed=(pauseit==0)? copyspeed: 0
9 T) y) @' Q1 \8 N/ P* ^$ h9 y0 \var iedom=document.all||document.getElementById
# | @0 A% U" |( Z* z6 pif (iedom)
: P/ e( p' J" Sdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
$ ^, R, y' V: a- f3 B/ K3 ^$ w+ T: evar actualwidth=''
1 m' J0 ?4 g) cvar cross_marquee, ns_marquee
( M5 N/ z9 s# m6 z' G
- f9 ^ a) ^. @* A1 t% N% o) afunction populate(){" ^ y2 r: \4 c! `/ K7 ?
if (iedom){& s1 \/ a: w7 t+ N' p# K
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee1 e) X6 g7 s2 a( ]
cross_marquee.style.left=marqueewidth+8
' J* U8 b' G9 Y4 P' B+ h2 ecross_marquee.innerHTML=marqueecontent4 O0 Z8 A1 `9 \ F; \
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth! Q6 P8 j, k1 D8 F$ F
}
, H$ `7 ^ N8 V! K) o) z) nelse if (document.layers){, r2 }4 T. r3 z8 C3 b! T0 m
ns_marquee=document.ns_marquee.document.ns_marquee20 u* r) A2 o2 N% f+ p
ns_marquee.left=marqueewidth+8- q( {0 }: p' D4 S" e( D
ns_marquee.document.write(marqueecontent)
; b$ p. J9 F: J Z* i; ]) Vns_marquee.document.close()
2 H4 H' |( F0 m& X0 {/ Zactualwidth=ns_marquee.document.width
! F5 J1 B/ b' Y+ x, H0 z) [7 b}
- P. J1 S) c0 ?7 [; P; j9 _8 ]lefttime=setInterval("scrollmarquee()",20)
0 |( k. X6 k4 Q/ c4 S}
5 S. u4 w5 H; i# v* D& S) Hwindow.onload=populate
[/ J( T/ G5 H4 e5 C# g' X7 s8 g
% S# C( a8 m# V! B) P3 @: \function scrollmarquee(){
1 R7 S/ v7 }, y0 lif (iedom){2 v! Q, C/ o7 \" Z$ w. M
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))( k& n. l o, O* B" D( X
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed! v9 p# c: |, q( ^- w# H
else
/ u1 Y0 O% f0 R4 ]cross_marquee.style.left=marqueewidth+8! X- N6 a9 ^8 X; o
* V% f$ t; _4 E5 I
}0 i- @7 b4 ?/ D! i* i
else if (document.layers){# P3 I4 L+ E) n$ n; w
if (ns_marquee.left>(actualwidth*(-1)+8)) n9 g) @- ^$ i* p
ns_marquee.left-=copyspeed
7 \& A9 @/ _# C* }0 t7 Gelse0 R2 m. p4 N5 D8 U6 p
ns_marquee.left=marqueewidth+8' T# E! p" ^% j* h% H- I4 h# z
}2 R4 \1 I$ E0 Y* r) t9 S- L1 ~
}9 q5 M* u+ O& @. m8 w
% _& O! N2 l5 x! [; U( k& R9 f# ?
if (iedom||document.layers){5 N) Y( c: f9 F
with (document){
' }5 v3 G. I' Udocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')) W/ A7 A8 G0 E" s, o/ R
if (iedom){* z$ H3 U+ I2 m* P* K; l
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')5 N8 |( z5 g, z, R
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
) H% P0 C/ n n+ w, N1 t2 E! vwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')5 x2 `2 @& [$ h0 X0 p' [4 Y
write('</div>')
" z, ^" V; u, ~! J6 Y1 i; t2 }}
# N1 V0 n5 i5 M1 `9 p6 p8 b/ selse if (document.layers){$ A9 y; f2 g0 n- A) v9 z$ P
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')8 {- g+ b; D+ I' V
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>') e4 b% x* \+ K+ e: f$ Y- y4 d
write('</ilayer>')8 J. G" z% `9 j$ N! h4 E/ b
}
+ i' l: {2 N0 p! H$ z6 O6 {document.write('</td></table>')1 ^+ j% e2 K0 I- K% c& b
}
1 l$ Q+ B9 a/ a {0 ~. t% ~. o8 @! r}
$ W) X6 R) ~( |/ ?</script> |
|