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

|
网页之跑马灯文字特效
//修改宽度" A% b1 U- z- p
var marqueewidth=300, x+ d1 y) T3 H" }% a+ }+ A$ `, ?
//高度. u4 L5 m6 T/ ]" D
var marqueeheight=25
6 Y8 q8 p3 H3 W& R B//速度(1-10)3 I4 q$ b* E% b/ _2 z
var marqueespeed=3
$ M( J7 X9 b# U$ G) o- K: A6 y" Y//背景颜色, i @* c0 G2 {. V! n
var marqueebgcolor="#FFFFFF": D- R# ?" u; Z; o! Y
//是否能暂停 (0=no. 1=yes)?
9 m3 ?1 p( E8 U0 D6 c: r( r% X2 Pvar pauseit=1
8 F: V+ s7 \( Q1 M# I7 F) F. j* N! Q5 _/ ^$ ~ w3 H8 d6 O
//修改显示内容
2 S# | I: l) I0 t) q. Hvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'4 d; v* |$ B; x# v/ t' l
5 V; a9 Y% z/ O: L& E- ~! p* Z. F
* p+ K# `" l. p2 t4 g% e////下面不需改变////////////, w4 I5 a' Q" T/ W
3 u2 \. t. n" o, _' B
var copyspeed=marqueespeed( _) l1 ]/ o5 c0 B- E* ~
var pausespeed=(pauseit==0)? copyspeed: 06 @$ y0 J0 y; X9 s/ p" |# A( Y
var iedom=document.all||document.getElementById
, z# O; M" h4 f! oif (iedom)
' ~" c$ J5 a3 N3 C! \document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')& n' l1 O! c! m+ r
var actualwidth=''
5 E. s2 c6 G6 }7 g$ gvar cross_marquee, ns_marquee" J8 m7 P. c. n# R8 }+ @8 [
& S8 W* N$ ~) m2 i3 O h- \function populate(){+ s% F3 L! R" Z
if (iedom){- v7 Z+ i* Y, ^3 j( j9 s9 F& K
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
8 n9 C% V% Z3 t: Icross_marquee.style.left=marqueewidth+8
! `% Q& @; u3 B8 ?. d, @4 u. m8 q5 e! mcross_marquee.innerHTML=marqueecontent
3 R: `' d8 L1 e' Y- Yactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth* U" D/ [8 I/ ~. Z
}
2 t, e% f6 H4 x" _# n& velse if (document.layers){
! S2 n' u9 \3 b' V4 R% e6 Ans_marquee=document.ns_marquee.document.ns_marquee2
% w* H- o0 f7 H, q1 c fns_marquee.left=marqueewidth+8
' {' o, n' x* K0 V. W. Zns_marquee.document.write(marqueecontent)- D @ p8 A, z6 C) A/ h4 t1 i
ns_marquee.document.close()
+ Q8 p# p4 i& ^% zactualwidth=ns_marquee.document.width2 B: V( _0 l* R1 A, Q- }
}$ j8 D9 ?# P7 F; v" |7 {: |
lefttime=setInterval("scrollmarquee()",20)
* Y) f, Y, z. t% ]" a( a}
8 r1 ~3 V- l( ywindow.onload=populate
; e' S7 R6 V9 j* t& i0 c
/ t( ]4 @7 I! h& A, bfunction scrollmarquee(){! B& q; [8 _, I% [
if (iedom){
: R: _! [- K; X( R8 p/ b9 @if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
0 L1 h; g/ s! c" L; \cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed9 p! ~: k9 {# s6 ]9 E! b; N
else' I, J }' O7 L' r$ ~% W
cross_marquee.style.left=marqueewidth+8# _0 _% Z6 p% N
6 e2 L0 @7 `; o! M. U- T! g
}4 i. o5 P- ~+ N+ @) w2 U. ?
else if (document.layers){
8 [2 z; g# W9 fif (ns_marquee.left>(actualwidth*(-1)+8))
1 {7 a1 t# ^; m4 Z& V2 kns_marquee.left-=copyspeed( d V* z* O ^% C, |; @3 D
else* b9 V# ~/ r4 T- H4 a0 ^& w2 V
ns_marquee.left=marqueewidth+8' N( I T }" \0 t8 L2 z
}$ r6 [7 t3 m9 {9 Q
}$ H9 O+ h1 C) E' r3 M
5 @: ?- {" V Z( c; U0 D9 h7 P8 D$ v
if (iedom||document.layers){" r7 }$ O j8 Y
with (document){
9 I9 T6 c5 a3 c" b$ Tdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')( z6 p( w1 J% m
if (iedom){* G" n1 N* T% @. A' P* c4 p7 y3 u, J
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
3 ]: y ?" N, r; ~& p. a- Dwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
5 A' t+ R5 f; t/ p; bwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')7 r4 A9 @2 T0 k# ~* g9 T5 ]# r, _
write('</div>'): W( P+ J. _# y
}$ c9 W" }, M7 i; j7 u- ?4 l6 Q! \
else if (document.layers){' x6 H3 S) x7 i& H
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')$ N8 {9 n# n; L0 Y+ t3 U( f
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')/ F* h% s7 l# }: b0 V( E8 b. @ q
write('</ilayer>')
# r! ^8 r, P, L7 S}
/ F; `9 N6 F4 W0 ]document.write('</td></table>')# y G) c9 I* r$ b7 u8 f( K. U
}
9 F; Y1 L; U1 S7 b+ y$ G, u}
( @) m" g% t2 \( v! m</script> |
|