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

|
网页之跑马灯文字特效
//修改宽度; P W9 E; d" S' Y7 ?+ r( H& ]# A
var marqueewidth=300' |- P0 K# d; w9 l
//高度
( T1 w5 k4 w# w/ u5 Wvar marqueeheight=25
* L7 A9 R! X3 d. s//速度(1-10)4 H2 r, a1 X- @9 r. N! i4 {
var marqueespeed=3
$ F$ t1 c' t& W6 B! D# k$ i//背景颜色' d) y( R0 U" E
var marqueebgcolor="#FFFFFF"
3 w7 c* z1 v$ w9 ~3 o# f/ M//是否能暂停 (0=no. 1=yes)?' x: Z9 ]. X' N3 b7 x
var pauseit=1$ L% @, G! }/ G6 j9 H8 r4 `3 y S
! l5 p& G0 M, i; w# S& V//修改显示内容. t$ P0 s+ R# a( E
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'8 x* t) s+ ~, N4 x4 }, ^
$ d8 b8 g* u) ]# c( I, |
# C4 Z7 g1 D# J) _
////下面不需改变////////////! Z" E. _" H4 s% c+ l) [
6 L& @. G+ U% S8 O$ Kvar copyspeed=marqueespeed
& O; J. Q+ g8 S% X" \var pausespeed=(pauseit==0)? copyspeed: 0
& } T9 Y1 L4 `7 d4 svar iedom=document.all||document.getElementById
, D9 P3 |( Q$ f) ?if (iedom)
' @+ V9 x. a, Z6 e- G# M' ^3 Vdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
" q$ u& S- G& |4 [- V* ~7 G: @) kvar actualwidth=''
* Y! a# M& G2 ?# Uvar cross_marquee, ns_marquee# v+ q7 J& s* B4 K
" e& a3 {5 D+ ^6 l3 L a! F
function populate(){
8 e9 z) V7 \3 h0 Bif (iedom){1 x' l- F/ }' j& v' r
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
# b7 L0 Q& M$ f0 Fcross_marquee.style.left=marqueewidth+8
' [: t+ f6 H* y% E3 o5 kcross_marquee.innerHTML=marqueecontent
' C2 c; s, t# a! w; C6 i- M4 {# Lactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth3 p7 @3 k6 `$ \, a
}
C3 D0 y# q+ G9 C% ]else if (document.layers){1 c1 I: v0 ^4 ~4 I3 F2 k
ns_marquee=document.ns_marquee.document.ns_marquee2
% v' x2 i* |! y) Vns_marquee.left=marqueewidth+88 [6 w' N$ q. J: P; j
ns_marquee.document.write(marqueecontent)
$ O( n% ^1 ?9 L) Kns_marquee.document.close()
& e) s9 v0 d5 l$ z# [actualwidth=ns_marquee.document.width: F) T' S! O8 p% b o
}
9 Z0 H$ i7 z) Y6 V$ elefttime=setInterval("scrollmarquee()",20), e, @: v) H7 `4 z8 o9 s: E0 X
}
+ {6 l2 r8 [% Kwindow.onload=populate* \9 |% N4 T9 d* d! b- I- j3 \
4 W3 B6 ^2 e5 Z0 M) K7 @function scrollmarquee(){
( P' x& |! S& }& [* ^, Lif (iedom){/ P8 i* a- P* o( B% O- `
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))7 L( ?' Q7 M1 x: z
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
, k0 G, u0 X( k/ b) r% r V. felse
2 P# r( y6 N% L* wcross_marquee.style.left=marqueewidth+8/ z( l# u: a t# n( o& d
" J! s" O& ?$ G2 K}8 h% B: w- S5 g% M- J
else if (document.layers){
' N" c. U+ n2 n/ rif (ns_marquee.left>(actualwidth*(-1)+8))
$ W0 ]1 T- P0 p( z4 L0 \# [ns_marquee.left-=copyspeed8 F( |' Q! K- [" R6 ~8 S
else8 f" J: a- F* A* c8 c8 N
ns_marquee.left=marqueewidth+8" ]9 A; \0 K; d4 i
}3 H1 }/ N# P6 p o$ T6 Z
}
% Z6 [% n6 d% j* w% L X4 g
4 O2 \! S* p- q0 s) {( Sif (iedom||document.layers){- ?3 N, }6 a9 ~3 X
with (document){1 N5 M, ?0 I" y4 R- w* Z4 J
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
+ @2 A8 L' M5 D1 G9 C- M8 ]if (iedom){! L0 j; R$ y3 Y
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')1 |/ ?* y- s3 v+ U/ @5 s
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
1 N8 K! l7 E4 j8 swrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')) _4 n. P J/ T: R& R4 P
write('</div>')5 w3 W5 G6 l/ _/ l. S; L) q( n
}
}' o# C& \( G delse if (document.layers){
+ Y* |/ u+ ?; a6 S3 g4 n' jwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')2 n; u* Y" ?/ i
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
( C9 E0 ^4 r! W' c* W/ A. Z8 Mwrite('</ilayer>'), T. s1 T5 @9 t8 B" V
}
r: _6 j% q0 H0 T' zdocument.write('</td></table>')
$ J6 Y8 T2 \8 a2 k8 g. n5 j3 O}$ o- A& H) R h: a( `
}1 M$ ?7 N$ V. R) H; q6 g; s# B9 p
</script> |
|