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

|
网页之跑马灯文字特效
//修改宽度
5 |5 K5 t2 h- W4 y$ o/ a, H- Qvar marqueewidth=300
0 |' {( @- y# |2 p//高度
# F3 J; |2 H4 F6 Y9 {var marqueeheight=25: z K% P7 Y- r7 y3 L/ G7 a
//速度(1-10)
# I6 e$ z: |6 F( Bvar marqueespeed=3
$ a" H. V9 q! ?//背景颜色% I+ X& g6 M( \( I3 J, ]8 [
var marqueebgcolor="#FFFFFF"; ~+ I. X* b- k1 z! I. `. u
//是否能暂停 (0=no. 1=yes)?
/ F: `7 ~4 V4 y& c- E% d1 uvar pauseit=16 T! |. L! d( u/ S0 ~0 J6 `
5 Z1 x# S, k/ M6 J
//修改显示内容
0 t4 l6 i# `: a& ?. [9 e {var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
: h" R1 U$ |, q( F+ }: E1 f
8 X0 @1 Q! @' i6 h6 T* c. Y! G9 e4 K
////下面不需改变////////////& S# a7 ~: k! @& L5 a* H" ]8 B& |% |
4 p8 B6 x+ i: M3 i4 Y8 V+ n
var copyspeed=marqueespeed# ~; Z8 l9 k: S% a, b7 s
var pausespeed=(pauseit==0)? copyspeed: 0
m2 ~" T& \& jvar iedom=document.all||document.getElementById+ U( t; k, \% m$ h9 ]
if (iedom)
5 C0 ~3 w f! Q3 |) k2 l& \1 xdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'), }5 o a9 {7 V& ]1 R; H% u
var actualwidth=''5 }1 ~3 c) X9 c/ R, H
var cross_marquee, ns_marquee& [9 |/ |, s9 t+ {$ O/ d) @' \3 o
- z: p$ Y( a7 B5 X) k9 J* Bfunction populate(){
/ Q6 }1 `$ Z v3 ^if (iedom){2 T4 |& b2 c) H& e! R5 [
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
+ ^$ v0 g- ?( r2 }3 v9 icross_marquee.style.left=marqueewidth+8
( ~: S+ K U u) [% kcross_marquee.innerHTML=marqueecontent: j2 p9 d- I/ F3 M1 e( j
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
, ]$ h% \3 E8 B5 _) b% r9 y% @}
* _& Y2 g. j" T9 Zelse if (document.layers){- q: o- V, N/ V" V" C3 x0 V
ns_marquee=document.ns_marquee.document.ns_marquee2 c* q" r7 y5 h
ns_marquee.left=marqueewidth+8
* X0 K6 [7 o8 dns_marquee.document.write(marqueecontent)
m0 ^' C8 z. D {ns_marquee.document.close()5 P; o; \5 Z9 Q$ u. Q, I
actualwidth=ns_marquee.document.width6 |/ w0 k+ [5 A/ F! w8 ~9 P3 P4 g
}
! e, G% t# N' f/ Jlefttime=setInterval("scrollmarquee()",20)6 Q- X( }7 Y/ S6 o" b6 G8 K- h
}
6 L" _" ~+ J: i4 J, ?window.onload=populate
: ~4 p& G( O. \; r4 @
- D; z* O/ b- bfunction scrollmarquee(){
! b+ N: A+ ?" l* i9 O9 {! b' U% Bif (iedom){" {0 g6 Y3 e' o) Z% n
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
, W7 V' \. ^+ s# t" g P7 gcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed5 P" X1 p+ t) l2 }% G1 {; S
else
: j+ W5 u) y( Q8 N' h+ Pcross_marquee.style.left=marqueewidth+8
4 H# a' X, j* F8 [: y5 q- U
/ P- U1 g* E/ i) }7 t+ `}
/ Z4 p- P; r9 I y% b/ c- C+ ]3 nelse if (document.layers){
8 h, ]* C+ L/ [% Xif (ns_marquee.left>(actualwidth*(-1)+8))
$ H. E/ I5 t5 U1 o1 }" b$ ins_marquee.left-=copyspeed
8 B5 I, {8 u1 `- m( u$ Belse* O' `/ H* s0 E$ i9 D
ns_marquee.left=marqueewidth+8; { u5 t# a& S4 n1 w
}
: W% D# b4 S2 }- l9 m' e}- K* \0 _9 j4 Q0 R# `
* q' e8 x4 _& ?
if (iedom||document.layers){* T5 M( }! C& R M" T
with (document){# T/ |3 G3 L8 p% I0 ]# N
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
$ F7 V4 H, D' uif (iedom){; M3 S8 ]# b0 a4 i& n
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')9 g; y& M. ]8 [$ b% P) w0 A
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
1 d- q8 i( k( ^; f- v- `- swrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
U4 o$ h1 S# Z, rwrite('</div>')5 E, O4 C' S4 h8 I) X* S. u- `+ ^
}/ ^" A& ^; r' ~
else if (document.layers){
( i. \% j; N& Ywrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')& E5 P L" V) v& {: ^
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'). M1 |) f/ g3 }) T% ~* Y: r
write('</ilayer>')
# p: d m- ?7 m* l" K}
9 V) o! U4 T# d4 ?1 W* U! w( M% cdocument.write('</td></table>')) G1 r5 ?* n4 P+ n
}
" B* f5 ?7 P; Q6 {2 \}9 k* H7 q+ C/ P" G
</script> |
|