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

|
网页之跑马灯文字特效
//修改宽度. Z% {/ {: r) \! ?" P2 A4 J* x" P
var marqueewidth=300* H, D& g3 p& ?7 O6 c
//高度
3 @7 J$ V9 V. H9 F1 bvar marqueeheight=258 E6 b" f8 [" A6 U8 j2 D! O) V
//速度(1-10)' v$ t4 C( ~/ u0 f7 `% N. Y& e, X% z
var marqueespeed=3% Z3 X5 I. @( f* W7 v3 Z
//背景颜色
5 [- v; c; G6 Wvar marqueebgcolor="#FFFFFF"
" I6 q! M s- o% ?# A//是否能暂停 (0=no. 1=yes)?
/ {9 h$ z2 C) E. M& Hvar pauseit=1) E* F e. U/ V
6 r$ o. s0 G+ h//修改显示内容! M2 Z) z( g* \
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
. a7 N. g6 n/ }* _5 o# D. U9 D% _+ z" k) w! r) @% Y2 `
! T7 ^/ d$ z% }7 J////下面不需改变////////////- p/ Y/ Y" f+ p) K/ H" i
4 X+ g" s% l; \% N$ r
var copyspeed=marqueespeed
, {8 Q0 n+ x0 k# Q) zvar pausespeed=(pauseit==0)? copyspeed: 0( Y+ \8 m n, W
var iedom=document.all||document.getElementById
" n: Z2 T. `! K+ L+ cif (iedom)0 J. N! R6 g1 y) w5 W& e
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>') S2 g1 w0 \( L. b; N
var actualwidth=''
0 C% n' k+ K) I _3 g! [8 u3 cvar cross_marquee, ns_marquee
0 Q. e$ M7 B+ m" F- W2 `# u7 t9 ]' _7 c9 B( d$ U
function populate(){
$ Q0 z6 S& K0 @+ s: M. iif (iedom){" S' V: Y& }. V1 g) W
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee( f; b( z4 L7 b! G* y: H$ r e/ o% P
cross_marquee.style.left=marqueewidth+8
1 \! m+ I* N7 |3 ^; ucross_marquee.innerHTML=marqueecontent
[* t3 b [: W- T; {7 d$ pactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth$ `( y W; R9 _+ v* l
}! Y1 h) L& e9 f- G7 \
else if (document.layers){* c& h. y4 w: \& l
ns_marquee=document.ns_marquee.document.ns_marquee2
, q4 V! p. Y+ d1 X; ?ns_marquee.left=marqueewidth+8
0 h6 m8 t& R* g! `2 rns_marquee.document.write(marqueecontent)
" n$ a4 [, G: Dns_marquee.document.close(). _9 s, }) i1 B% M9 n+ x0 h$ f
actualwidth=ns_marquee.document.width
5 X0 ~) g9 f* q- ]- U}
& c& X, A" _8 @lefttime=setInterval("scrollmarquee()",20)
" t& v [5 S$ R}
; a, \. J8 W$ ? L! V$ swindow.onload=populate0 S) n5 j# \1 Z! N( w
; R3 q0 J* k+ y# |
function scrollmarquee(){
; G* [: ^% r, F9 u& }5 y( [* ~8 Uif (iedom){
" N0 c6 q5 B& d, A- K1 pif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))1 D5 l2 n1 j+ L: z2 l
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed. G, m8 E7 [4 y/ J# `& r
else
# q# z1 T0 m* C$ T5 R( Ycross_marquee.style.left=marqueewidth+8
; N" s2 l6 X7 m3 z. C
# k! G3 ~3 Z- ] {}/ j/ B3 J& ~; f9 g3 ^0 C- C6 V3 ~3 I
else if (document.layers){/ ~8 `3 k- s {
if (ns_marquee.left>(actualwidth*(-1)+8))
4 X- _1 C' d ]. ^4 C! @ns_marquee.left-=copyspeed
( V7 W# t! h @. }6 @3 |4 x/ }else
4 P @8 `: D4 c6 g" d4 ens_marquee.left=marqueewidth+8
F% s4 [, P9 O" H}$ W: K6 w! B+ n+ D+ `
}
4 U& p2 D7 r7 [: I
& a! T/ i' [4 _# k W0 U; t6 nif (iedom||document.layers){( E/ t% F9 m3 Z& m3 y% w. {! w
with (document){: Y* i1 i! `! A3 G. N& Y2 H
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
4 m# S) v: `7 e7 w% O- a3 gif (iedom){
3 K" I9 B9 a/ g% ]& P- i) m9 E. {& Uwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
# T& p! P5 f* H7 E' x( _4 c5 zwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')0 H i e* b, S& ]
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
0 Z% N' l- F2 j H* Iwrite('</div>')
) ~2 h5 A. X$ t0 [* ^6 L}( ]# K3 M' ~! W2 O; O1 A
else if (document.layers){
2 `* Y$ a6 I$ u0 Y' x f* Awrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
d2 g+ P! B& g! ~# o/ vwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
; d- N& E& H# V! D$ @write('</ilayer>')" N; E5 m2 z' |$ a6 K
}
7 h6 o% @) N4 B/ d9 C8 O% idocument.write('</td></table>')) F+ K% D J; I% h" o5 G, `
}9 _7 W |7 ~. f4 J
}9 W1 ~/ J0 |2 l" q" ]
</script> |
|