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

|
网页之跑马灯文字特效
//修改宽度- Y1 W! S, h3 t7 L
var marqueewidth=3003 g2 j7 q) h- ?4 u4 U
//高度0 t! e. c- b5 Q
var marqueeheight=25
: Y3 e" }1 c# A2 Y4 X3 a- Z//速度(1-10)! b7 ~' h+ u# c4 s' h
var marqueespeed=3' ]9 j" ~5 _, m: C
//背景颜色5 w" a p4 [6 x! y T
var marqueebgcolor="#FFFFFF"( u3 ~" G/ {# `1 j* R6 d
//是否能暂停 (0=no. 1=yes)?5 C, \( A0 w; Z# l" ]5 I- t2 ?+ X% A
var pauseit=1
% ?+ Z, q; {, T: _/ e) x1 U# d5 W) `2 d
1 O: Y; t" ^) ]5 v7 f5 H//修改显示内容
7 E* v' n5 i: M4 C' `* zvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
& g$ c7 H6 Z( W2 K
! Y) Y. G9 q; o; m- ^3 l
& X9 Y5 W# p4 {+ \////下面不需改变////////////6 h# I R5 _' u- }
2 U- W' ^, G- T/ J4 }$ Z' Uvar copyspeed=marqueespeed: c' ]6 F! L1 Z z% s
var pausespeed=(pauseit==0)? copyspeed: 04 P; @0 B4 v3 i6 M) w) {$ B4 u" c
var iedom=document.all||document.getElementById. C1 o }0 u8 x6 _4 H, s8 [/ ~
if (iedom)
. b3 v+ U& u. B; F. W# H5 r8 odocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')$ T* {1 t* D! n. T) i
var actualwidth=''
' C8 f7 j. ~- f! a& Bvar cross_marquee, ns_marquee g3 O& J3 V. _! c/ m
1 q$ A6 R: h- j. Y4 I. q. Z: F% \
function populate(){" u- q: }3 B. D
if (iedom){. W) }. I3 B$ h+ ?
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee, \$ [4 b* B% z. Z2 j
cross_marquee.style.left=marqueewidth+80 b8 w6 B, j$ G0 i0 d6 P
cross_marquee.innerHTML=marqueecontent
, ~# A1 U, e$ ` E" O1 D# F' xactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
( a1 I: [- |! x0 q) V: H* d7 S} e5 K+ k9 B; t3 I$ m
else if (document.layers){- u. t# X6 C/ v( j7 g
ns_marquee=document.ns_marquee.document.ns_marquee25 C2 W0 D- q9 M8 `5 x2 S, M
ns_marquee.left=marqueewidth+83 V% L* }6 F7 A, h4 l2 @$ N) z5 S
ns_marquee.document.write(marqueecontent)
) {8 v r* M! R# r0 V! Uns_marquee.document.close()) B K! Z" `/ s- G* _9 A! z
actualwidth=ns_marquee.document.width
' t5 P; i0 n9 {( K}
9 |# B1 ^8 Y7 c2 A w8 b \6 @lefttime=setInterval("scrollmarquee()",20)) d9 r1 i* u+ g0 F
}0 \& z2 k9 G5 L- a9 `- I
window.onload=populate
! ]' k( Q9 _+ {+ `( |5 ^' C7 @+ w% G# j* n5 i9 d$ i
function scrollmarquee(){
: a0 L7 I+ J* P# Wif (iedom){
" n! V# L" ~+ ?if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
# o- B. R; n2 {# O; }0 w Y1 Vcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
4 W Q7 g6 C# @8 ]: \! z8 c. i( t; ^else
4 Y. N1 k, c& |3 Y/ E, e* Ecross_marquee.style.left=marqueewidth+8
3 ]$ D" K# O- @" w' g5 g- {* d1 y
- O ^3 T2 N1 o7 f: d1 f}* b4 l5 Z* }/ y J- Q
else if (document.layers){% t! w# v7 M5 y9 Q+ d0 n) o$ h
if (ns_marquee.left>(actualwidth*(-1)+8))) H ?, i7 ~2 g2 A& f
ns_marquee.left-=copyspeed
5 l/ n7 M- o& V, q* }& \9 Telse+ J2 k4 o: Z/ Y: g
ns_marquee.left=marqueewidth+8
c! p' t* d) k' @4 o}
. o7 h0 _8 J+ p; C) o Q}
" `: i3 r0 |1 J' } e) a( J
. O* u0 Y0 r: p _* {9 \. k$ Q+ t4 ]if (iedom||document.layers){" l- ?2 T# Y+ `% S, ?
with (document){
* v( M w- D6 }5 a. kdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')' p- I; w. G9 c
if (iedom){
7 S: u- b1 c% M, A6 m Mwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')2 F( J! S& ^( ^+ p1 f# ~( d% c
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'), E) n$ _( z u! N) A
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
3 t- I7 }# X1 V- Z* O hwrite('</div>')
9 k+ P }3 s+ a/ m2 q}
5 w. A6 d/ k/ qelse if (document.layers){8 h5 q$ x( o: w- ?6 r1 x
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
2 X, m- O4 _2 [: r! [, |1 l9 wwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')/ h( ?9 J% f' V. i. m
write('</ilayer>')
; e$ y5 I2 @8 ?; X3 ~: c}, R9 ]0 P' G2 a7 R
document.write('</td></table>')
P+ d1 v9 h3 r/ Y$ @}* i' e+ j/ M) q7 U5 [
}
. g: }8 `6 A* y% n; n* }4 l. v</script> |
|