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

|
网页之跑马灯文字特效
//修改宽度" G" n- j3 m# G
var marqueewidth=300- g" l2 M8 c( {: ~0 }
//高度
! _6 v& H8 E# i4 V5 bvar marqueeheight=250 v7 s0 W7 o/ S9 t- W$ D0 ^/ e
//速度(1-10)
' b0 G0 }8 _' Z" W7 I# M& svar marqueespeed=3
" v8 {' \/ o- e5 N# G& i//背景颜色
" M; Y$ `: A' h' Uvar marqueebgcolor="#FFFFFF"' y, s3 I0 }6 n$ Z
//是否能暂停 (0=no. 1=yes)?4 w- h% g5 T$ H
var pauseit=1. u& ~' x; c. q* |7 O6 h! B% }
& h: k' n/ ~& L5 A//修改显示内容( a9 x/ W7 e" K; U
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
: @ k. r) z! e8 k: V* T5 E% c# _) b, _6 ?7 c
4 c2 i5 d4 @% }% y# U. H
////下面不需改变////////////" Z' j4 }; ?4 \3 t
* g# g/ a' p* L2 Q- ivar copyspeed=marqueespeed7 F0 H+ I4 N. E" V# E u- |& s
var pausespeed=(pauseit==0)? copyspeed: 0$ w7 ]) s: `' }* k: q' K
var iedom=document.all||document.getElementById
) n' k" b5 C+ M5 I' T( j; yif (iedom)% G4 z% {: e/ A5 o9 n9 F0 d
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
( P8 P& J2 e% z0 evar actualwidth=''9 j V. g/ p; {9 _6 U: K5 n6 [
var cross_marquee, ns_marquee
4 T) b- Y9 H( J& o
0 ^5 o6 Q2 m4 y, f J: t1 W6 Ufunction populate(){" F$ y6 r7 `' Z2 o
if (iedom){
+ N1 k" F- ~* X3 v3 m/ Y U2 icross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
3 e0 a4 E9 w' L0 N+ J8 f- Ocross_marquee.style.left=marqueewidth+8, k; k( S# j! E3 h& T4 u: w
cross_marquee.innerHTML=marqueecontent
; K$ ?, @0 b& dactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
, G% M+ |& R9 h. Q( v: a6 m! Z}! n$ h: Z: w, M" }7 E
else if (document.layers){0 T2 E" g- W! Y5 {( V
ns_marquee=document.ns_marquee.document.ns_marquee2
1 c% r, k: d/ K, d$ z0 kns_marquee.left=marqueewidth+8: a6 C& U( [2 R
ns_marquee.document.write(marqueecontent)
1 j+ m- M! a! f k) m! h4 U2 I/ Y9 a3 Qns_marquee.document.close()# C, ?8 w6 E! J1 b4 W
actualwidth=ns_marquee.document.width
5 `5 k7 w4 J) `}% G B1 o. N! v* Q( w
lefttime=setInterval("scrollmarquee()",20)
2 o* ]4 {$ _7 w- K, a- o) Z}
7 B0 n& p3 D% B9 N6 O8 {window.onload=populate, S! \( _8 b p/ { k
5 T3 C# e3 O. b! U( E4 V
function scrollmarquee(){
1 r! a, Y" S0 I. u2 hif (iedom){; b2 k4 h, h5 \
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))$ `9 d8 t; S8 v4 Y+ \
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed( `7 q: B' ?( Y$ L1 }7 t! H7 q5 j
else$ h8 j, _: g8 L7 c* w: I G: i
cross_marquee.style.left=marqueewidth+8
8 j) \7 L! Z7 m) X/ Q+ t
' A# O: k6 A5 D4 k1 g8 a, s* t}4 \; g7 q9 n9 X
else if (document.layers){
, \. D! p- H+ G9 X0 p2 Qif (ns_marquee.left>(actualwidth*(-1)+8))
1 P) K4 g3 X2 q5 z! Yns_marquee.left-=copyspeed" T1 ^# E0 F; L
else
4 E* K/ v+ |$ Y9 D/ f, [) Tns_marquee.left=marqueewidth+8
5 [! g6 a! A( [. b2 A}
, P( z$ B/ X- q( P p4 f! n}
% T" Q7 z4 u4 i9 V/ ^3 I
7 g6 e4 m, b2 O ], Kif (iedom||document.layers){
6 Z) i) F% [8 t h/ Nwith (document){
6 S# u0 o3 q! A$ _7 Wdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
# A- N( X3 w* N( E" Rif (iedom){2 ^" j9 {( `9 l; b+ i: t
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')/ M; R: O4 k: P; s
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
5 w! Y2 E) i! [: Pwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')' S }* c, m# {- {* j6 F# T
write('</div>')$ K7 _+ X A/ N4 Y- {, S6 G
}/ H% q2 R1 F. ^2 | K" U# f
else if (document.layers){: Q6 ]4 Q/ w' j* ^# Z8 h
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
: Z" H+ h% h% Twrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')1 _( C$ C! ?; O" D, d8 t
write('</ilayer>')
: j+ R2 z* U+ V* n0 b}+ E1 @$ Z9 f- o/ r/ n4 v) p
document.write('</td></table>')
, ]% `1 e5 o4 P3 c8 r% d- f}( t2 ~: Z: Y! L {5 z
}' q+ C" S% @& `# |
</script> |
|