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

|
网页之跑马灯文字特效
//修改宽度( F% |# v! w! n7 Q
var marqueewidth=3007 N, q8 B9 ?3 D' U+ w. E2 R
//高度
, \! c3 d2 Z$ {4 d% d* b% }! R w/ pvar marqueeheight=255 i- j2 z+ v- z* |
//速度(1-10)
, y0 Z1 ]' `& A$ X2 bvar marqueespeed=3
8 i% O. ]. t% M# ^6 D//背景颜色
$ k7 I( A" N) l6 K4 P2 D* Hvar marqueebgcolor="#FFFFFF"
' G1 K7 c1 s5 J3 |5 V$ A//是否能暂停 (0=no. 1=yes)?# I9 k9 m6 p! I. Z
var pauseit=1: P* Z8 ~1 b- j9 S: N
1 ]2 V: i* t( G! d. ?//修改显示内容4 }, ]0 c& A6 A
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
7 n/ j& _- l$ g* @0 a; e
8 L1 `$ i1 |1 }- E! Q6 p3 G* A2 q/ V7 ?. S, J- F
////下面不需改变////////////
" ?0 [7 J8 F! N0 @% v0 ]% I( [6 N% s9 B+ |* L5 z
var copyspeed=marqueespeed! u; }* E" t; @
var pausespeed=(pauseit==0)? copyspeed: 0+ i3 r8 ?; N1 ^& Q/ ^% t( u" ^# E3 n
var iedom=document.all||document.getElementById
% o. _) g6 ]( u* _7 ?if (iedom)4 e7 ?; F9 b q1 h/ _
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
+ W* N! g( e! |9 B9 ~3 [var actualwidth=''
) j' E6 h4 ~0 z6 I/ |& p$ `0 y& X4 d( _var cross_marquee, ns_marquee
% C9 |0 }( D. _4 P) b, w+ E" g. P2 i/ a6 P; A
function populate(){
0 c% F; o% u8 g7 Wif (iedom){
" r1 i0 L! e+ Q% R0 @cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
* O6 q8 X h0 v0 y7 y# D$ ~" vcross_marquee.style.left=marqueewidth+8% m4 t' S, i* D* z& n- R! V2 M& R
cross_marquee.innerHTML=marqueecontent
' V: o% [& W! l7 U3 {actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
# ^; ^: A( J9 b, E. `0 M1 J}
* |8 d7 X; @! r6 I i" |& Nelse if (document.layers){: [# M# l% c2 `" P$ a
ns_marquee=document.ns_marquee.document.ns_marquee2 W) F( Q1 F1 Z
ns_marquee.left=marqueewidth+8
4 J2 U2 L" U" W% y( e/ pns_marquee.document.write(marqueecontent)
. k ~1 z: j& A) K" Y) @+ z6 fns_marquee.document.close()) ?! Q- y5 I& P" I) w: Y4 O
actualwidth=ns_marquee.document.width
4 Q: B5 P! v! Y5 U7 \}
$ w: ]- v1 M& Y8 ?5 L, ]9 flefttime=setInterval("scrollmarquee()",20) N/ O+ s6 u* }8 G1 q) F; R! {8 l
}9 p2 Z% f i! G1 S
window.onload=populate2 f. X( ?1 o5 |/ t
$ T0 J, r) u ~- gfunction scrollmarquee(){# d" k. i$ N5 |7 u
if (iedom){$ d6 A. k" G* X5 ?
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))8 k; |. @2 |& z; d. x) c1 d
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
/ c# T9 r# r8 s; `) Felse8 }9 @. W3 a$ k2 `6 z
cross_marquee.style.left=marqueewidth+8
5 ?/ X1 p/ `8 @, _- q6 O @; A! G t+ I7 `
}
# }& M' P; q* y! G/ P$ B- `else if (document.layers){
+ G9 Y+ Z! D" C) H% G* M0 \& l. A. K5 bif (ns_marquee.left>(actualwidth*(-1)+8)) G, Z+ k( z, y$ p, {) u- q
ns_marquee.left-=copyspeed
# J* L' C9 A. Y Zelse
, M; G. L% j. ^- Wns_marquee.left=marqueewidth+8. K* m2 D2 x9 Z; f! u2 @
}
# C% L) e! Y7 g$ {, R2 y" v. ^& E1 j}; N8 P, i+ R' z; } g
( j" U# e) u: a
if (iedom||document.layers){' _/ d) r: f/ S4 A
with (document){
! n% b4 O! w/ ~) x" B& rdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
$ G9 {- i3 c. d' |if (iedom){
! L- c: ~" g) @! P9 ~, uwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
- b) U r8 h* a' ~# Ywrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'); M1 H" k; v: o0 b
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')7 t! ~2 A, C9 O# v$ w8 @6 `
write('</div>'); Z+ b h. y: f! A6 [, v
}6 m9 B4 V' H6 T5 i, ]" P. I" J. G( ]
else if (document.layers){4 h& ?( |1 v5 m" E$ L
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
- `- i" H" y' E( Jwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
1 a$ T& G. J: ^8 S- {( d8 C: }: R$ cwrite('</ilayer>')1 ^+ D* f6 U: k' y# e- ?! i
}
. e# l$ `; [( z1 J/ v( ], Qdocument.write('</td></table>')
4 r% N) Q& |/ D' L0 h# X+ p6 ]}
. s: H4 h4 Q: o0 j- r}
1 \3 |" w* h# J' y; M0 f</script> |
|