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

|
网页之跑马灯文字特效
//修改宽度5 P- C% v% T) L, q% q% t7 W) A3 r
var marqueewidth=300
" @. u3 Q( s8 I9 n/ s- b* m//高度0 R* v0 R% [7 ?1 b5 T8 K+ C
var marqueeheight=25/ C7 _! {/ r- E: F
//速度(1-10)
* F7 }& r' z' x5 ivar marqueespeed=3
% y7 N! p2 t9 ?7 E z" K//背景颜色
1 I9 f5 u3 s+ u% bvar marqueebgcolor="#FFFFFF"
1 Y; r! S8 g, u4 T* t; n, r//是否能暂停 (0=no. 1=yes)?" r# Z& d5 D8 K* t+ N; x
var pauseit=1
: F1 S' Y% b" O& O' y: J% o8 y- H' x5 |$ V6 q2 Z& z9 ]
//修改显示内容1 S( D5 M7 d- f. Q2 y0 ]
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'$ c0 C6 J B+ M& U9 h+ i" ^9 K
) [1 B' n- n2 n( i- v- }/ i* D4 F
8 ^; g) ^9 d( h M! V////下面不需改变////////////- r( H1 V* r; o. z- e
9 `# ] a- A: w8 |3 ]
var copyspeed=marqueespeed
" _" l4 N8 q) D; [4 p+ [var pausespeed=(pauseit==0)? copyspeed: 0. r2 Z2 B: ]( {
var iedom=document.all||document.getElementById
9 Q) R8 g+ O5 Iif (iedom)
4 f n) h6 X- J7 M/ a: ^! x7 X) W$ Pdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')* @2 V' c- e1 h* }0 C2 f7 g9 {
var actualwidth=''
# B5 k: b+ _5 v( N# f5 c* Gvar cross_marquee, ns_marquee
: c- |; f3 t1 H0 U% K
, u" u2 U8 P3 v- S: G2 t/ tfunction populate(){& u. o0 O1 D7 ^% D1 M# P* k* k
if (iedom){
5 s* H$ e. h6 Y4 k, P$ Hcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
1 h! p$ `5 ~2 t$ {# i. c `cross_marquee.style.left=marqueewidth+8/ Y2 {+ l! g' ?) ~# f: Z
cross_marquee.innerHTML=marqueecontent
) X7 C+ d1 R# ~/ _ P1 Z! \actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
/ I+ E" n7 H8 d9 \# e}
% ~' V: h. F5 [, |7 ~) Kelse if (document.layers){
8 ^% i3 c) U) M/ j9 bns_marquee=document.ns_marquee.document.ns_marquee2
9 f; w3 i9 m- [1 _& N# W$ bns_marquee.left=marqueewidth+80 [! ?) M" t6 j) S- r
ns_marquee.document.write(marqueecontent)
' N: F6 k' L& a0 m) r* ]) Jns_marquee.document.close()
: e+ b' t& F, {; }4 i6 x, lactualwidth=ns_marquee.document.width
9 B5 u' O" z7 L1 c7 a# k' k}: Z. t$ ^9 |9 k& u4 X, P( H
lefttime=setInterval("scrollmarquee()",20); L* A( m9 }/ R" R. n, o
}
& \1 G. p; m1 _1 H1 dwindow.onload=populate/ }, M/ `, D4 U! f# O' Q
" {6 |7 X2 ]* f4 k* w$ d, j# _
function scrollmarquee(){* o2 T4 u; o7 \
if (iedom){
6 |' a; X1 \" pif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))# a0 I7 m( g, z! ]2 x; c
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed! Z9 a% e- V; ` k' v6 Z0 I' b
else6 X" @: K) Y" X# [! P5 \; w
cross_marquee.style.left=marqueewidth+8# g- F4 o0 Z( A5 J9 l* T4 a/ g: l
, |5 I& Y# @2 L/ u+ l/ c
}
$ A: a8 u4 @6 q: e- Relse if (document.layers){
2 d: U7 l) w6 T+ c% Bif (ns_marquee.left>(actualwidth*(-1)+8)). g7 V* G# s" V$ o
ns_marquee.left-=copyspeed2 I$ v/ J* ?9 Y& t2 n; ]" j
else
) q2 [0 J" T: }8 Zns_marquee.left=marqueewidth+8/ {, x/ x/ j; }, K
}: ]/ d2 j0 X' s
}
! F8 _# J( o6 X" [2 T
* I1 c0 j2 [# V# Z" }0 ]if (iedom||document.layers){; x/ o0 t; O5 A7 z$ ]0 G- J
with (document){
2 e$ d6 @7 N2 G. T7 Q$ vdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')# G8 m( w! c( I4 |
if (iedom){" ]0 A+ K: X' p
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')$ I' z' c5 A- F% z0 v8 @, O
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
/ i0 c# Q' J2 ewrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')# A. t8 e2 J8 y9 f3 G
write('</div>')
: n0 ^) A4 c2 `, p* U# e}
: a$ p( r5 S) _8 |6 q" A! Uelse if (document.layers){( ~5 Y Y( C" {+ H4 @1 S
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
- B! t4 v5 C0 ^( |$ S# Dwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
y& y( n' |0 e6 w) V6 C- p& \write('</ilayer>')3 I' N; p/ ]+ C3 ~8 K' A8 `0 x
}
: |# P1 c2 a* ^% W( K$ Q0 V9 A0 Jdocument.write('</td></table>')# B3 r5 S3 [' j, c
}
, }+ R3 W- |5 T8 E}$ v0 q! O0 y$ e$ w0 x: s
</script> |
|