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

|
网页之跑马灯文字特效
//修改宽度
$ z! n. i- Q" [! O* x3 T! ]9 F, a: }var marqueewidth=300- e: ]" v) D% }% R
//高度1 h0 B& z0 V! S# l: B4 j- f4 b
var marqueeheight=25, H2 j5 M2 Z. T+ E- G! W
//速度(1-10)
; A1 @! G- o. a7 {6 R' @var marqueespeed=3
1 G0 R9 F, r$ R: h- |//背景颜色0 u" |7 n. M* c/ D" L7 N. L
var marqueebgcolor="#FFFFFF"
8 i& Z& \/ j! K& [- \3 ? v//是否能暂停 (0=no. 1=yes)?0 c1 ^1 d3 P& Q3 a8 g. Q4 B
var pauseit=1+ i; U& q4 R% x) t) r, I y
9 O- O7 X' T. G% W1 n) v
//修改显示内容# z# W9 p9 S' d1 O6 [/ g4 i
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
) R# u. @1 X7 {5 q$ W# r2 P7 S( }
$ h) X9 Q- `* Y* j. [////下面不需改变////////////- h) @% |% k) d
" [9 L7 R6 L" d0 k e% `$ k& \6 v
var copyspeed=marqueespeed
' o3 F7 \& b8 `7 r/ S) kvar pausespeed=(pauseit==0)? copyspeed: 01 L( I/ U6 _' x
var iedom=document.all||document.getElementById
+ C$ _( d k/ x' `if (iedom)( d8 y- V. O" h- Q/ Q r
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
# n- g- C! X' V# C2 ]' }var actualwidth=''/ c0 P; E9 E+ s" n5 s- e$ k5 {
var cross_marquee, ns_marquee
3 e7 }- Q* { T2 F6 }5 X8 q! h+ u% f7 i: X/ ?+ G5 k( d
function populate(){ \8 ~' l0 H% P6 I5 s
if (iedom){% z% J# R2 t8 y( `- `1 n+ I
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
% _: I* t( b" D+ t, P8 T5 J" q2 ?cross_marquee.style.left=marqueewidth+8" T2 x! Q7 }/ {6 L$ t& o6 g# R
cross_marquee.innerHTML=marqueecontent
/ }2 R2 t% L0 t) cactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
y2 @ w0 ?5 d2 z9 J}4 e5 m7 o( z, j0 V6 |
else if (document.layers){* z6 V$ }& i2 N3 Y( i
ns_marquee=document.ns_marquee.document.ns_marquee2( d) M' ]! R' b* M% P
ns_marquee.left=marqueewidth+8, t5 }1 Y- n7 `* l! n. L8 o/ a
ns_marquee.document.write(marqueecontent)
h& Z+ h: t7 E! T& cns_marquee.document.close()
) d) h" ]7 k) M |8 Tactualwidth=ns_marquee.document.width0 O/ f. i' D6 k5 K7 p4 z, N ?
}4 C3 n |3 g4 R& [4 f& G- ^1 G
lefttime=setInterval("scrollmarquee()",20)
/ B, h% d, B; {; R# @0 ]+ q}/ t& w# B9 b/ {8 H8 ?3 l
window.onload=populate
7 X2 v9 r4 f( H1 J. `' U
1 F5 f' n' N$ W1 mfunction scrollmarquee(){0 ^% Y; D0 X' p) }, c& O7 Y& r
if (iedom){1 R7 u; V9 R% c* I
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
' K0 t# h3 E& G; m. Z- Y" gcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed. W& u& M. B; V% C
else: P9 b' v& Q1 n; g
cross_marquee.style.left=marqueewidth+8; q F# h# E- O. L
: V+ r( ~! p. [; n0 ` O}
1 r9 `5 E! \* e% z+ xelse if (document.layers){
- w0 a: I' Q% i7 [: k5 {if (ns_marquee.left>(actualwidth*(-1)+8)). R: ~* L9 P7 W. B% U; i, w6 _# g
ns_marquee.left-=copyspeed
' {; c+ f) H4 O telse
$ W3 x# |6 z# Y/ ?$ Qns_marquee.left=marqueewidth+8) H$ b. Y( Q( n, e6 V4 ]! `2 R% @- L+ ~
}9 N7 I& x9 G/ }1 x; l+ n: b+ c# N
}/ t/ e& E, Y- p$ G3 j8 B
& a: m# I/ \& l" V" M" {
if (iedom||document.layers){
: ~: {- E. v4 V* E1 Ewith (document){! n) f2 ?2 a/ k* v/ e& G0 P
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'). V, T2 y3 {/ C) Y8 w8 c
if (iedom){
2 c% h5 A8 r! H7 {write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
2 O4 m: ~& S/ }1 bwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
; n2 E" ?% x1 r' x; B Zwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
5 Z& i; J7 \7 q0 v& e- y: ?write('</div>')5 C, b5 a3 b& m* _, M4 x, _; V2 T( [
} c9 `- W# X; f' o9 @) g+ f' y
else if (document.layers){
, s- g& l! o* D2 k. Bwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
n' o$ d- f* A+ iwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
$ }7 R8 A9 I8 H5 s& Iwrite('</ilayer>')
4 H' r0 ~6 f& y6 }; P" {. _}8 N* @5 C6 Z9 P* J% i) {! z0 `
document.write('</td></table>')1 @' w0 E* U( `8 c% P8 A4 K. T
}
& Q. k! ^" \# ]! P, W7 s* W}+ ?1 ?' H, J# _, [2 N
</script> |
|