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

|
网页之跑马灯文字特效
//修改宽度8 I& M& N8 g( i7 C
var marqueewidth=300
( H; i- X: U: Y5 V2 _. w//高度- C7 U- `& }! p' P- q
var marqueeheight=25
! T1 g: k5 Z# o) J6 V7 c+ U//速度(1-10)/ b* @: r5 |5 D. W R0 H
var marqueespeed=32 U, i6 w8 D" z2 q( [" d- U$ Y
//背景颜色+ U. U5 v2 F( T# Y6 J
var marqueebgcolor="#FFFFFF"4 S0 F% a& F( u X1 c
//是否能暂停 (0=no. 1=yes)?
1 o( m+ v9 x5 S3 }var pauseit=1% b" ?2 h. N* K( O3 J7 L2 N
6 ~( R1 s$ _1 y$ E B
//修改显示内容 O8 h' ^7 c- R7 i6 _" ?8 `; K/ d% [
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
8 I& E# N" P% x: D; @; t- P2 y4 s: {# C- k
- x0 b" L" h! T- U) {3 S0 K) c5 j////下面不需改变////////////) y* n0 i1 k5 d/ C+ a
0 a8 @# |2 L+ a2 C fvar copyspeed=marqueespeed$ t/ O! A; G7 T. e. J, e
var pausespeed=(pauseit==0)? copyspeed: 0
$ P9 A. C9 n+ |' a; I7 lvar iedom=document.all||document.getElementById
+ `% [7 s) P; {- r5 u! gif (iedom)0 c) q+ d8 N1 ~# ^: ]& P$ K0 F
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
1 ^ U: f/ P( o9 uvar actualwidth=''
/ I/ B* u- P q6 qvar cross_marquee, ns_marquee
( N# L$ a3 H, I# y, C7 o9 }
/ w V% m( U+ B7 ]5 W3 t8 W6 yfunction populate(){
7 j4 A+ e. b/ ~4 }8 sif (iedom){
& h2 L4 _* F4 \/ C o$ Q5 l7 W6 fcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
6 I( u" U2 g. X+ J" B" q) M6 Icross_marquee.style.left=marqueewidth+8
. @7 c( s7 q4 X O5 W/ ucross_marquee.innerHTML=marqueecontent
7 ^4 b6 P+ M' O8 Q; ]actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth: i0 |; J# e. {' Y4 N; f
}
. t' o* D2 A; K, b3 R$ selse if (document.layers){
& K* P M( \5 e$ @ns_marquee=document.ns_marquee.document.ns_marquee2$ n+ K' v1 o) {3 \% Q
ns_marquee.left=marqueewidth+8
9 c/ a' Y8 i" j" I" J3 j$ E( Cns_marquee.document.write(marqueecontent)# _; a' `& a. e T/ L9 @2 V i
ns_marquee.document.close()3 m, s% p) p" A0 N) g
actualwidth=ns_marquee.document.width; f6 I+ y3 V# O$ w) n; U" ~ ^/ Y
}
7 J, C# L3 Y, U' {9 r' j4 hlefttime=setInterval("scrollmarquee()",20)
7 D6 N1 R! ~: g4 x2 ~6 x}1 _+ k0 Y& T {4 S2 C
window.onload=populate7 }0 F1 z8 G5 E D1 H4 y
4 P3 m. }( C5 z. |1 y% O( w: s
function scrollmarquee(){* w) o* _+ y( H6 T9 g; V; A
if (iedom){
- I" z j7 h* b( hif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
/ E& d# S8 v' ~$ V% Y/ `* r, p/ |cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed# a7 b- m* c# n" b2 Y) L5 q) W
else
" P& a% c) U' g; H7 Xcross_marquee.style.left=marqueewidth+8
( ?# }: {3 _# t
$ ]8 q1 M: b0 s# ^/ H+ u}2 G, A8 F( I' E7 R8 l6 x; r
else if (document.layers){
G% L4 D! G5 E: `+ yif (ns_marquee.left>(actualwidth*(-1)+8))$ g @! i: y( H! M! ^" |; c
ns_marquee.left-=copyspeed" l! [6 W$ O5 C& r2 T
else
$ |& E! p& t1 I; Y' M6 w+ L% p9 e& Zns_marquee.left=marqueewidth+8
a7 B: z# x: c! d2 H: W& r}
& c3 s8 j9 `7 h4 T8 R}
6 o; Q) m8 t% {5 R
7 ?4 q1 q0 M8 `; R$ f$ @' \if (iedom||document.layers){6 d& s, i9 A& }7 P7 S4 A6 m1 n8 y
with (document){1 v# \$ i% f( q a
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
9 H' ]0 e3 ?) Z( A) f pif (iedom){; M0 H5 _" R) S% L1 T; f
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
% _. P6 S1 A6 |- v9 Rwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
$ \6 H U; M& v- `/ [write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
; w9 Y# e& |4 I( qwrite('</div>')0 }7 m* @7 J0 r8 v
}/ i2 \* o5 u% Y9 {1 r# o3 k
else if (document.layers){
7 x. J0 U. `# B+ R5 Uwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
' q( T3 }% y* ~* Y4 O: B( T- C' Lwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
2 V! x5 s8 V' \2 |- N; a7 X3 s1 Uwrite('</ilayer>')
) r- M! T r( i$ N}8 E/ L. T: M. d; F) m! V
document.write('</td></table>')
4 }, f) z8 u8 q( p0 A0 R}& @/ M! i4 v3 R+ ]+ z
}% h+ x) |8 L) C% b8 B- G& z1 {
</script> |
|