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

|
网页之跑马灯文字特效
//修改宽度
$ @ V4 z+ n( V! ~0 z8 s0 Cvar marqueewidth=300. C/ c6 k. Z. }# \! J
//高度6 A$ _4 S! S* Z- h4 V! ]
var marqueeheight=25
4 A' o1 R" B' [5 e: ] T0 H' i//速度(1-10)
r( N8 S6 q) uvar marqueespeed=3
# R; R) |/ D+ j5 r e& j2 c//背景颜色7 i5 C& Q7 g' J F
var marqueebgcolor="#FFFFFF"
% V% m" d* I! e//是否能暂停 (0=no. 1=yes)?
( d9 C/ V, b% [) \7 S- O% Ovar pauseit=1 y4 |& u$ a' x5 ^. e& |/ Y
9 L0 G9 Z: Q1 F- f: `5 W//修改显示内容# f |; g' O8 W
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
6 U+ s* S! s. p2 S0 O3 h y- I# N
" Q' D: |: D; z# P# i
; P9 h+ V' a/ W8 E* i////下面不需改变////////////* \6 Q( z2 ]" R5 d" l" m
& N- ^3 R5 Z) H% c' s$ I5 Ivar copyspeed=marqueespeed
' Z+ [: K, p0 x" a% o3 Qvar pausespeed=(pauseit==0)? copyspeed: 0
1 l" w6 R6 A# B' x6 rvar iedom=document.all||document.getElementById
- l. w, W0 U' `+ W8 Mif (iedom)) s* D e6 P9 Q* I2 f/ ^ ?
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
# _$ s8 D/ x: x1 c' u" O3 fvar actualwidth=''8 g0 l- {! e7 \! A, A2 j4 P `
var cross_marquee, ns_marquee5 W; G; m8 X1 X( ^
4 a. P- y0 ]) e0 R' Z9 T
function populate(){
2 H8 m) [$ `/ E" ~3 bif (iedom){) R9 Y2 D( k; V4 X$ l) Q
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
* u- [5 g1 e* i. E1 Lcross_marquee.style.left=marqueewidth+8
' S% m3 \ m' ?. R: D fcross_marquee.innerHTML=marqueecontent/ h9 U2 S9 @! B
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth1 e! J0 P5 j) ?
}2 | X3 c) y* L( ~6 T7 w" @
else if (document.layers){. a% Y. F" `* R2 n, b" u+ Z! E
ns_marquee=document.ns_marquee.document.ns_marquee2
3 K( }1 v4 ^. E; Fns_marquee.left=marqueewidth+8
8 @3 m* k/ @6 W$ N; S3 ~/ B% Q& yns_marquee.document.write(marqueecontent)
4 k2 N# q; U( H/ G' G& dns_marquee.document.close()% E- c% ?. z8 d! b3 i0 Y
actualwidth=ns_marquee.document.width5 p( U6 o( S( @( i6 |
}
2 z# ]; x, O c7 @. a6 N2 T4 J1 A; hlefttime=setInterval("scrollmarquee()",20)/ S% I$ |% d+ L5 l
}
0 b+ b A8 S1 k8 M* Rwindow.onload=populate
1 \# `$ H$ h- T/ [1 [8 R1 P6 @8 v$ B# ?6 J, }! o
function scrollmarquee(){
- T+ t( G, k1 K1 l0 dif (iedom){
/ n2 H! p& F |" r3 U0 x5 X8 Lif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
1 ~9 c4 R5 f/ \5 U6 Z0 B+ m; \6 zcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed3 ~- a& o2 E% u
else' P6 @5 j# r* d* I$ I
cross_marquee.style.left=marqueewidth+8% s3 p# f9 h) N6 @+ I' G! M4 d
' L6 V3 b1 X) U1 m
}
* G; {5 W0 U* g6 Melse if (document.layers){
& x) b( [7 l6 G5 Z7 _' h+ x& Cif (ns_marquee.left>(actualwidth*(-1)+8))
9 Y& V# x* {1 R) gns_marquee.left-=copyspeed
1 q6 I' ]: v% x6 W: @' T4 M5 _ q+ o! Welse) Q1 N! ~; k$ D+ n) ^' B* n: v
ns_marquee.left=marqueewidth+81 w( _+ M! p2 ^; h/ K
}' ~: L0 b6 ]: `2 B. Q
}
- H( G+ M+ L# g% B0 p' E) @
$ b& H+ @& y+ K# V Q3 cif (iedom||document.layers){9 k2 U: h" |, x- A) G8 j
with (document){; A* z1 q: e! z: l- o
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
" q9 B, R) f2 }9 qif (iedom){
9 q* P! k8 L$ |$ {write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')0 A' c+ j2 t: O1 K* \# c
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')& w N5 A/ r- E, L$ R
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')$ M# o* g! w$ A1 d
write('</div>')
0 U' p0 r, ?2 x2 @: K3 Q$ m0 a3 _}
, `8 ` V* d3 |* x# felse if (document.layers){
, c% S& p/ x# B$ t- \4 W' twrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
* v" U* [; j; o4 S; `7 P9 Nwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
" ~( B( K9 ^9 q5 i( S6 `write('</ilayer>')
* k5 }# G, E- v1 W1 O6 k$ E; e' I}! }8 e& p- L* b* x" R) D: T- B
document.write('</td></table>')5 G3 ]8 |' x( d7 X- _
}7 Q' ?$ t. L: _. I
}
, i" w6 S8 D, H& y( s8 Y</script> |
|