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

|
网页之跑马灯文字特效
//修改宽度2 ^: `/ R; e6 p" @5 L
var marqueewidth=3007 D2 b+ p" v9 x W4 ?% |& E
//高度4 K- {) P6 L1 x4 _- Q0 g
var marqueeheight=25+ y# _9 \: _4 i& k; ?9 p
//速度(1-10)
" [! a. j1 w ^+ Y/ m0 H/ }/ c" evar marqueespeed=3; a* r# o8 N$ S- M/ [
//背景颜色
. D, m) p8 m( p- \( X* @% {var marqueebgcolor="#FFFFFF"# v8 z6 a5 k$ D) R1 D6 m' ^3 s; C
//是否能暂停 (0=no. 1=yes)?, i3 `$ H( i, b1 I% d8 k3 D1 a
var pauseit=1
^ T) m+ G% o% _6 [
# N1 z; l- l2 P) }//修改显示内容
# X6 ~9 b& n; I1 ?* V5 R6 `var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'# q2 V8 W C" T/ U. F
/ X/ J4 J1 U- Y4 ~" i* M5 M
, Z0 \$ W0 v) S3 b////下面不需改变////////////1 o6 a- F7 j4 \" y5 \! Y! ]
8 ~8 D! H, C# Mvar copyspeed=marqueespeed
; z8 `9 Y# J! H& Z* L: Fvar pausespeed=(pauseit==0)? copyspeed: 03 ~3 E1 Q3 m O0 @
var iedom=document.all||document.getElementById
6 p0 p: v2 u* T, C$ C8 Q0 c) s4 Kif (iedom)7 P( u1 D( t6 c3 B4 h
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
/ z3 R- L+ n8 \- g$ Y6 Cvar actualwidth=''
1 O% q8 n# C& V ~var cross_marquee, ns_marquee
1 z1 {. g7 e; s2 o" p( q
! d* s4 T/ i: h- Dfunction populate(){, `2 I- T! Q/ `! ^, E% R- @
if (iedom){
: h# p( u7 C9 Vcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
7 S; Y* R+ n9 S. m- v- p! D4 icross_marquee.style.left=marqueewidth+8
. l* X- C1 m( P; x4 [5 R3 Y: o, Dcross_marquee.innerHTML=marqueecontent
3 z; x! J+ P! y3 O5 `+ B1 Zactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
X$ {/ ^) }; O1 b" ~: d: [}
6 \! n. U7 S" B* |% Felse if (document.layers){+ L2 A5 O: e+ j1 `/ v7 ?6 Y
ns_marquee=document.ns_marquee.document.ns_marquee2
6 U1 J0 K3 W' }. J6 Ins_marquee.left=marqueewidth+8: F$ S- ^+ s- k: V5 w. J( @9 n ]
ns_marquee.document.write(marqueecontent)
( g3 J8 V$ H4 Z3 [ns_marquee.document.close()
& k- l- T" W# e& eactualwidth=ns_marquee.document.width1 G6 n9 ^0 O+ k w! w$ d3 q
}
0 B$ a( q, W/ _' U$ b5 K1 M( Rlefttime=setInterval("scrollmarquee()",20)
: A4 x: N1 k( ?# E3 |* ~}3 T& D( f$ g% L; x2 o8 V
window.onload=populate
$ @( T9 K; i( p+ V9 D2 u. j1 y% s
function scrollmarquee(){2 X2 A" Q/ C! a6 i& |
if (iedom){
T- Q& C+ o/ Z; w2 A1 @+ V9 tif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
9 ~- g9 h% s% p( S, d! |' Ncross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
( q# e. Y3 x" @2 Oelse
& w6 u8 M9 W3 U8 `, n; ~cross_marquee.style.left=marqueewidth+8
4 S) c( [" `5 g2 m, y$ K+ n" B/ v& W; c
}! \4 z8 B: Q$ _& ~
else if (document.layers){. ^: ~, q6 H; I) n
if (ns_marquee.left>(actualwidth*(-1)+8))
- b: z, ~, a) s, b. c6 rns_marquee.left-=copyspeed
% W0 t z& Z' U: L0 n, Helse/ A7 p8 q# @5 m4 v4 p- x/ q
ns_marquee.left=marqueewidth+8: Y# s/ H$ X8 r
}
; \: `4 o, G9 e; @% F" P& }# R}
3 n, l. \" p& i! I' ]3 Z5 n; t* L" o0 B% P* ^
if (iedom||document.layers){3 ^3 _' W5 L/ [/ |
with (document){2 q$ }* [) W4 R% n
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
, V' h% q( t3 b' @4 [4 yif (iedom){' F8 Q$ m; v: o0 I, b
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
, Y% m/ O( m" fwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')+ s i% F0 G# Q
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')$ O+ p* i6 e' e2 j4 e1 n$ ?
write('</div>')/ ^) l6 o- h& W3 b
}
% D6 f% c& M% J6 d, |/ q% W8 u4 y uelse if (document.layers){/ b. t, B" H( B* x
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
8 Q2 g9 x, r7 z( i6 |8 Pwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
; W( J' G+ l# N0 j, L# K/ W1 J( Cwrite('</ilayer>')
4 ~8 [) H7 v# j; Q! N8 h) H}1 W9 J4 }* d. d# }5 b
document.write('</td></table>'). `/ t- z7 M. ~5 {
}
' d1 K, x {$ L0 o8 }; s}7 r" G- f* O& X/ m/ r: K! \
</script> |
|