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

|
网页之跑马灯文字特效
//修改宽度; z. u) T1 {3 V; V$ J
var marqueewidth=300# R1 P2 j+ f2 f0 y
//高度
7 B, V9 R0 \9 W; C5 `7 B+ a, Zvar marqueeheight=25# ^( R1 S- m# T# t: \3 g
//速度(1-10)
/ ?0 `% w# e5 e0 R9 I `$ svar marqueespeed=3: O2 b; `8 [# J& b3 u$ S; `
//背景颜色( d6 Y; ]3 V+ V& T
var marqueebgcolor="#FFFFFF"6 e1 V" [6 W6 _! ^9 x
//是否能暂停 (0=no. 1=yes)?' j7 M% K# R! V
var pauseit=1
" i* \* K5 h/ S6 v5 l
$ e& M3 X0 e' X/ c4 m//修改显示内容3 `7 ~, U" P- b/ J' l
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
' p$ a0 I, E4 l0 A, I6 k* |) P! |: V
" }$ S# I! b1 v7 B////下面不需改变////////////
8 Y3 y( g2 J: H% m8 w! q8 K7 \( X- s: M, \8 T+ `5 j
var copyspeed=marqueespeed% n% L' }+ ~" k5 V. B: `, E
var pausespeed=(pauseit==0)? copyspeed: 0
8 w6 E9 t+ r$ q! J- `6 ?% ^, `var iedom=document.all||document.getElementById
, Y6 K. T+ v. g( W8 J6 p; Bif (iedom)
; j' [3 U$ {* W6 ^7 }1 M9 Gdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
a: @0 c! U1 k) `/ s. Rvar actualwidth=''8 m% V, l4 g4 u$ Q
var cross_marquee, ns_marquee
6 d- ^, w1 d# o* F" Q( D2 S5 a, B. m' P
function populate(){3 {: j5 G3 ?) ] P; ^4 `
if (iedom){3 A1 X8 m8 \! V6 @
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
\+ X$ f2 a$ mcross_marquee.style.left=marqueewidth+8
" K; f5 j; w: |+ c- S3 x" rcross_marquee.innerHTML=marqueecontent
6 l4 W* N. i3 @$ L% o* R7 _actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
/ T! m) i* n& O2 K5 [. E3 x: ?+ b: {}
" Y4 z+ J+ ]' i2 C( [else if (document.layers){5 Y) \4 w' D& R7 o6 B* o+ N9 u
ns_marquee=document.ns_marquee.document.ns_marquee2" ^" x7 ] C$ d+ r( w! r
ns_marquee.left=marqueewidth+8
) ~. o! Z# R# `, t1 vns_marquee.document.write(marqueecontent), ] j2 ] A( Y5 m
ns_marquee.document.close()
! [6 U A/ }. M8 f- y0 z5 gactualwidth=ns_marquee.document.width( k: Q, u1 m O, X
}2 e. c. ~( P0 m4 C. P1 S5 O7 k
lefttime=setInterval("scrollmarquee()",20)
0 ~0 N# Z1 U& }# T+ ]3 z4 b* K7 K}: W" n" e1 m4 @
window.onload=populate
3 }* k6 G2 H: m- _/ g B+ M( D/ \
; F3 T: A) R# ]' W/ P7 @function scrollmarquee(){
3 H2 W& u6 [9 `8 {, ~+ i; d1 E4 cif (iedom){
: Y- ]/ @' S6 _# o3 V3 L+ Z8 a4 aif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))7 @; ]3 _8 n* l: l7 j5 S
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed4 _8 w R5 H9 c, Q3 d5 ?
else0 i0 }$ K- ~3 u# |$ E3 r2 Z
cross_marquee.style.left=marqueewidth+8; P+ Q4 J) h) J7 g; \0 C9 e3 q3 ~- t
6 x9 ` v+ V+ o" w) o+ J+ O, I1 l4 U7 ]
}8 J. U: f# ~0 U' l- c" D
else if (document.layers){
: J" M8 _2 V, I% V: k# ]. Oif (ns_marquee.left>(actualwidth*(-1)+8)); P+ W. f: @7 o% K# y1 y+ M3 J
ns_marquee.left-=copyspeed" E$ v5 b* T: N0 r4 P- a4 P
else
- C* ]+ h( g. L/ I- J( ons_marquee.left=marqueewidth+8" ]3 Q9 g" F4 L6 a5 Z) i7 m
}
# ^( P( m$ a8 q+ {6 u$ h( f2 C}' e/ `& R0 Q0 G# X
- s* }6 Q9 n3 X. M6 x$ ~( C+ }if (iedom||document.layers){
: H+ G9 o: R2 L/ F% q/ qwith (document){
; w+ J! j8 n; J& |$ bdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')# y6 i2 X% A4 d0 s. i; P' S$ ?3 Z. I
if (iedom){$ X0 e0 I$ T, r( t8 `9 k8 B) V. S
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
( n7 N+ X1 G+ Q) E1 c* Y# \' R" uwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
/ @' ~, L1 d" x: P; I P3 _( e4 ]write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')$ j+ @2 V3 P9 l; V0 {- T2 u
write('</div>')) w# R/ y) t' [6 m3 F9 V5 ~
}
2 k+ j6 r b% J' U$ T4 }( Z5 w0 nelse if (document.layers){3 J5 f" }0 o0 {! P5 ?5 W
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
& t) W, `- B: w; N* s: ]write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')! ]( q) Z7 x: w/ t1 G% \8 r
write('</ilayer>')& _) t5 M# V# x3 F
}
3 |' ]$ }+ T( q% Ndocument.write('</td></table>')
; b [+ ]# j% b) b5 w: C0 ?3 r}) m( \4 X; s Y/ l
}1 z" G6 n) M$ v: z5 m+ @0 B$ L
</script> |
|