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

|
网页之跑马灯文字特效
//修改宽度
' q1 t. ^+ n4 f, J. r1 M0 ?* J% Jvar marqueewidth=300
" f- `) e. U. c. M6 z$ h5 q//高度
" V' O9 O* ?. zvar marqueeheight=25
; a5 v3 w" K" G) m y. H) O* G//速度(1-10)- J2 W$ s/ o1 c; p$ ]" g
var marqueespeed=3) P. U3 m& p1 J6 \# k% E" w( i7 C
//背景颜色
$ T; O- T4 |2 Gvar marqueebgcolor="#FFFFFF"% ?: \9 g0 L1 y5 {# s1 r: |
//是否能暂停 (0=no. 1=yes)?
2 R s# c8 e$ W5 X2 ^var pauseit=1 L% v- x2 [: R- E! H, K
1 s- C2 D+ U& V4 m//修改显示内容
. A% P5 W: ~0 Y' C4 {var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'4 \! Y7 X1 m" i% n1 u. {+ G$ t
! p2 D" H0 i; J' n& W5 e
% t. v# I; b- o0 f. X////下面不需改变////////////
9 \! g, e; T- }3 g' A- F, R7 U* Y+ T& V. q$ z, D* a
var copyspeed=marqueespeed8 W* y: F$ s2 k7 c0 t
var pausespeed=(pauseit==0)? copyspeed: 0
, A$ R7 T( @0 |8 t4 w: h* E c Rvar iedom=document.all||document.getElementById: |' U& ^. y: j& l+ y) S
if (iedom)
! D x$ m. d* }( [# P$ edocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
/ i3 L& C) f2 b: i9 F+ P) bvar actualwidth=''$ X! b! n6 a5 r
var cross_marquee, ns_marquee
3 N) }8 Q) s- d$ |) [' Z8 W4 ]8 q$ R' p
function populate(){) s o8 e( x9 [1 n
if (iedom){
7 T- y0 y" \! o! m% T2 G ?8 k& qcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
, ~& I/ k) i9 [5 G0 P, u2 ncross_marquee.style.left=marqueewidth+8 w5 s) K3 `- X* J" C
cross_marquee.innerHTML=marqueecontent: ^" h! Z4 W' L% ^1 _
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth( H, L6 l, \: o7 {- [7 w: e2 K
}$ c, y8 V* x4 ?( i6 o& f6 @
else if (document.layers){6 v" D$ F8 v2 k* v4 T9 o% u" i `
ns_marquee=document.ns_marquee.document.ns_marquee2
; P3 N0 l* |! J" F" W M/ Kns_marquee.left=marqueewidth+8
- T B& a% Y4 i5 H0 N2 Bns_marquee.document.write(marqueecontent)$ \5 }; ~7 Z: e' C; M) y% k( Z; S
ns_marquee.document.close()
: G# w3 h$ |/ u# h; ~$ Oactualwidth=ns_marquee.document.width! ^6 ~/ N7 l9 S+ i" @+ M0 _4 z
}, ]. L( Z! ` _9 f0 \
lefttime=setInterval("scrollmarquee()",20)+ ]. n# \3 T4 A+ K9 _
}6 K2 l3 G0 C' |7 F
window.onload=populate- Q a7 ~. ?* }8 |2 t; n _: J
9 a+ _+ o2 l+ c( n O% O7 G! `* N$ P
function scrollmarquee(){
5 |. I* z; F. P( B# Zif (iedom){1 e. w; l7 c; ^
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))! V$ b. j- r- M" V5 R( f$ |+ \
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
. L$ {: a$ f5 N+ t" F% p5 F5 G6 helse
" M( P( J3 n! m& Q, i! j8 H- g% }cross_marquee.style.left=marqueewidth+8
: \% O1 U/ x' {' A: c S1 l! G- M* k5 M) ~7 N( @8 J
}
, o5 F: u \' q" U, i, Ielse if (document.layers){3 s% D# M0 U9 d% A1 A& e, p
if (ns_marquee.left>(actualwidth*(-1)+8)), n) W b' K# H8 H
ns_marquee.left-=copyspeed2 }& g& J, i9 t; J3 d% A4 v- Q
else- c8 r. a9 u( \
ns_marquee.left=marqueewidth+8+ a+ x0 H6 ^0 @4 |) O7 \
}, ]6 H$ X( d1 L% M- J6 A }! B2 a
}
8 ~2 d2 Q7 o" @; k2 ^* o
O8 Y1 i# G& w8 L# mif (iedom||document.layers){
7 ~6 O0 l5 _ a$ ]# Uwith (document){
( D. b" @6 e1 W- Y: Ddocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
# `2 y" ~) ] xif (iedom){
5 a& r* ~' X0 Z, c8 _( m, i# G6 Rwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
3 [' E& M7 {. j, Ywrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
8 @6 |5 _* U0 G% L! c- c) K& |& Qwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')2 O2 k# F1 ?/ K: p/ _ n+ P
write('</div>'): u5 o1 A# S- f# a9 h) [: b' T+ |& z
}
: D* M4 d" c5 q+ ]' |' ?else if (document.layers){
7 U6 E$ B4 [& @write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
% ]+ O& J2 j2 uwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')9 H. d- l( F7 j/ ]& N9 @
write('</ilayer>')
2 V7 P( o0 V: m5 n( W- b# W! J}
8 i7 a% u' i' ydocument.write('</td></table>')
# A2 E) v C# e L3 R% K7 ?}
; i( v5 J* E/ n}
\1 m' k J% g8 N- T5 A</script> |
|