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

|
网页之跑马灯文字特效
//修改宽度+ \' V7 h# ^& q/ X
var marqueewidth=300
7 T- j' `0 J5 k0 x/ L//高度
/ P6 A) u+ f; a8 R7 ovar marqueeheight=25/ s9 Q9 Q6 D/ j
//速度(1-10)) m0 ^7 Z1 x' d" h
var marqueespeed=3
8 u2 ]& ~8 a) j' G& t" h5 I& F//背景颜色: x: N% P9 D# I9 [
var marqueebgcolor="#FFFFFF"( `- \9 ^" M% l7 m1 ]- w6 `
//是否能暂停 (0=no. 1=yes)?
8 P& X# L; |+ L) [var pauseit=1
7 E3 x# ]3 Y: ?) w, `2 f7 n3 x) m" s$ T+ V9 f
//修改显示内容
& G& F( U! i+ k* W" D$ I/ Lvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
( J5 k: I7 ~( A/ M+ }) [- o1 D/ S- k, p+ G( j+ f8 k
! F( m. Q+ p3 H( z1 a5 B) g# q////下面不需改变////////////" W& ]2 n, Y3 g
1 j1 y$ [. k# O8 [; n4 B
var copyspeed=marqueespeed7 ^5 r/ J$ f- l) `
var pausespeed=(pauseit==0)? copyspeed: 01 Z J* @5 ^# X1 @! y. K6 B
var iedom=document.all||document.getElementById
& i9 Y2 z: m+ b$ c Hif (iedom)/ `' W, y3 ]- M' K" y$ D
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')7 u2 f& J6 S' h& u2 m+ R! I7 c1 F# S
var actualwidth=''. a! H$ v' U6 b/ {4 E
var cross_marquee, ns_marquee
a9 x! Q) {9 M/ ]( u) Q
( U) R7 s) [/ U, M* dfunction populate(){
_. r* X5 c+ _if (iedom){ N% E6 S! {9 V0 m
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee. g0 q; M% z. `4 w
cross_marquee.style.left=marqueewidth+8
E4 o# ?7 M$ [+ I) O) V% I5 Rcross_marquee.innerHTML=marqueecontent* D/ a/ v3 R4 B; p& Q
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth' j- T" X+ H9 H' N/ M. u0 X
}
7 t' J, C) U' U2 ^" Pelse if (document.layers){
' {( i- w' C& [; R/ uns_marquee=document.ns_marquee.document.ns_marquee2
! V+ }: I* G& sns_marquee.left=marqueewidth+8
& J% o0 f9 {# b! I; I0 r2 mns_marquee.document.write(marqueecontent)& q# R8 }* v2 P( x+ P2 h
ns_marquee.document.close()' z3 r6 L# o1 k
actualwidth=ns_marquee.document.width
/ w) `& M. d6 l! t}
& ? }$ v3 w' W6 y$ ]/ nlefttime=setInterval("scrollmarquee()",20)
, s4 @" W9 }7 y1 Q: K N0 U( ~ P}
' `/ _( \* R, E* Gwindow.onload=populate
' X6 S8 A) N, u+ d9 p
1 I5 b! { x# Tfunction scrollmarquee(){! C/ e5 d. G3 M6 ^8 K! o8 Y+ c
if (iedom){
8 e* T4 B# C7 e j$ }# j5 @if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)) p' E d/ M! u+ E3 d
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
* Z% c4 d! b5 l+ l4 Uelse
& D! y7 T2 q/ T& ucross_marquee.style.left=marqueewidth+8
0 J" y' s: Q. p( e4 K
( D" z% r- ^; x& a; C$ K* @, p}, S" X; h( X# m/ G
else if (document.layers){6 i: \6 _! k8 r! H g! c
if (ns_marquee.left>(actualwidth*(-1)+8))
0 {# A1 E# u7 V5 Zns_marquee.left-=copyspeed
, X/ a5 g2 W: R/ f2 celse
. m. G3 x, g$ ens_marquee.left=marqueewidth+85 N+ i% X$ g0 F# ]- s2 U: L* @( k2 Z3 q
}# W5 q$ G6 S$ W r4 f9 Q) ?, O
}
! J( p% I3 }, r* X
0 G7 F; t/ h* b3 H9 f; v6 wif (iedom||document.layers){
; b6 h& P. N/ ^# O& ywith (document){
* ]5 r+ b, N2 i% Q! N" ]. b8 ?/ Sdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
" N$ O! e0 }/ ]! X) Cif (iedom){ K1 F& m R7 |; u9 c/ b- n
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
4 w' [: _: A; c- U% b; X( wwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')% T! n- X- r1 z5 y4 F, I! C
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
/ }7 ^( S1 P0 \. p. v+ Xwrite('</div>')- \: |, Z6 m) c' _0 ~/ K. X- |( e
}
1 |( C9 s+ d0 B$ e Z2 M! Zelse if (document.layers){; T* O! g! o/ N" S& _
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
; `$ h) i; z6 G$ ~* Fwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
, D) g4 v5 Y; o1 c4 zwrite('</ilayer>'), J. v1 O& B8 y
}
6 B" `( x' L$ w6 ]& V6 `9 Edocument.write('</td></table>')* k( K+ t. ^9 n3 T
}
% c( S1 B8 O" r, S}" D4 P6 h p1 Y
</script> |
|