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

|
网页之跑马灯文字特效
//修改宽度. N, H8 F+ e. q M4 W( @& W
var marqueewidth=300
/ Z+ S3 N4 W% h0 t G2 L; [//高度
; P8 i9 _2 U j8 F0 M X6 H5 F% l( Z. gvar marqueeheight=25! D% g5 `( t/ _& ~8 L2 T
//速度(1-10)
5 [& N5 K; x+ p" d" L0 yvar marqueespeed=3
) W0 [9 g( q, `8 |* S! q//背景颜色
6 ` N" a; p% Cvar marqueebgcolor="#FFFFFF"& }7 c9 k# O: _. P2 v6 k( N W( [
//是否能暂停 (0=no. 1=yes)?
& X" `* g+ j3 c- s& `var pauseit=1
* G: @6 |( W- r7 M- z$ J' Q0 `/ m. M8 ~
//修改显示内容
/ }2 \( f4 G1 t: V! A1 Yvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
; Y+ p, g+ N" _: T' s3 q1 m
0 ]* O+ g; B/ |# Z: |
& p" P4 f3 w2 l3 [////下面不需改变////////////- O' M" C) _# D4 v3 T+ Z
" s% e4 S+ q5 y4 k! f5 c% ~, ^var copyspeed=marqueespeed
0 i+ m n6 T4 p: j- K( i1 r& Rvar pausespeed=(pauseit==0)? copyspeed: 0) v0 o) \! c% h3 A$ U. O
var iedom=document.all||document.getElementById
7 F; j& r% Y3 u$ P7 H8 `1 iif (iedom)
+ E# ^7 B: ^# Y* R5 S0 M3 bdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
- d+ y- Q/ S# n2 {var actualwidth=''
0 r: s8 U: h pvar cross_marquee, ns_marquee% T0 N6 j0 c, }% Y. o
7 y# M1 a1 ^9 V, Efunction populate(){
& f o$ Z# `, H* q4 k/ Eif (iedom){3 D( z3 ?7 h" f; E* U2 i$ Y: v
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee0 u' Y' W) Y) b$ i' `7 D7 r; M
cross_marquee.style.left=marqueewidth+8$ ~0 Z r: u* k% m% x2 H* E
cross_marquee.innerHTML=marqueecontent0 ^ F" a- F G$ c! q
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth" s2 `' T- E8 p5 N r+ j1 a+ z
}- f1 V& ?5 {" | P
else if (document.layers){: [" W U- ^1 Y' N! t& W+ ^, R
ns_marquee=document.ns_marquee.document.ns_marquee2& [6 X- w; s7 |
ns_marquee.left=marqueewidth+83 j, |! a/ P. {. ]3 U9 z7 }
ns_marquee.document.write(marqueecontent)3 `: J; R" p0 J7 d9 U; B
ns_marquee.document.close() ]8 N6 P# n0 ~$ P- @ G
actualwidth=ns_marquee.document.width% o' O) V H: G1 }2 f
}4 y3 \$ p" F4 b& [, N6 s9 E$ b8 Z
lefttime=setInterval("scrollmarquee()",20)
# o- m5 E- K1 r/ S1 W O}% p) t @ \( v/ o
window.onload=populate
$ S" }" D9 v. ?! {; i8 b7 F0 a% k2 `& G# B A: W8 J; M
function scrollmarquee(){
& M3 u* x; u$ d: x2 C7 c( F) j: a8 Lif (iedom){0 G9 _8 o9 d# ]" Z
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))3 ?: P) D6 j2 W
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
- }9 s: ~6 N9 Z! {7 b4 k7 xelse3 J. b9 H% x6 S8 }! K
cross_marquee.style.left=marqueewidth+8; I' n, E4 }% r1 @! E9 f
: x1 w( `9 P/ L; n}$ j! M! H0 `. T% ~# p5 z+ Z
else if (document.layers){
8 J- t, d* ~+ d9 u/ `# p" uif (ns_marquee.left>(actualwidth*(-1)+8))
1 k) _/ O. I2 H' B! p3 `+ @" x3 Jns_marquee.left-=copyspeed4 |5 l: c! h0 ] p) G8 t% |
else3 _ ^* p/ C, o3 s4 w
ns_marquee.left=marqueewidth+86 Y) i" F7 F! K# E
}6 l. C. C, ?, |2 T: o6 z' d/ c
}
- u, G& x$ u! q) E1 V
- [8 w6 ?3 X( \) {6 y1 `5 H9 u! iif (iedom||document.layers){
7 F( o& z% O( F9 ]0 d kwith (document){& i* b6 t5 n: a
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')! _9 m' i5 ?$ K# C
if (iedom){
7 w5 M8 j9 D" A$ S* u9 ]write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
$ K4 S0 D" I/ A7 k3 Iwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
: l/ d! N; ]5 Pwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
1 ]) W( Y( x& R' h. p4 t, bwrite('</div>')
# V4 F, {! d% ]2 o. [6 L+ I0 x}
# l) b" @; A; Belse if (document.layers){
1 v L" A2 @/ N; O. _0 m; bwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
9 d- l0 x# ^8 k6 Z, [write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
5 W# `# e8 N1 Swrite('</ilayer>')
1 X! z4 S# ?* E3 z' _$ a: w}
2 U9 B: U) D' \( U6 ^document.write('</td></table>')
! N3 o- ^3 s, c. F f, z}1 s) n& P) k% L
}
; I! d ~ a. P+ E</script> |
|