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

|
网页之跑马灯文字特效
//修改宽度
9 z. Z5 l9 D& d o1 C6 e0 u2 A) _8 Yvar marqueewidth=3005 z5 [1 `4 q+ N9 h. V
//高度
3 w! ^( @0 Z8 ~7 ^9 ^; O# rvar marqueeheight=25
" m& n! {2 G8 @- u2 _6 Q+ t$ A, D//速度(1-10)
* _; ]5 B4 O8 \$ zvar marqueespeed=3+ Y, B) T$ q6 g: H9 ?0 z
//背景颜色
" x5 f0 D1 ]/ W. B/ Ovar marqueebgcolor="#FFFFFF"
1 i- X/ V0 V Q/ p//是否能暂停 (0=no. 1=yes)?% e m$ i$ B( v0 g0 Y
var pauseit=1
" `. @5 g3 `6 `6 U/ E% ?& B" ^! P
6 F3 ^6 V, V- g, ~% z) W4 A//修改显示内容: l( X. O2 w; _: T6 x
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
& Z- ^/ I" b- ]- ?) z1 s% o. Q7 Z$ o8 a3 t
) l; ~- J- S1 d" N4 N////下面不需改变////////////# s2 _; J% B1 P" C/ m" }+ \. C
% Z% w/ q: N6 P! E5 Y
var copyspeed=marqueespeed
- t7 Y1 R- `0 C3 e. x; g) Evar pausespeed=(pauseit==0)? copyspeed: 0
, _# J* [9 g2 a& g0 [1 ]! |var iedom=document.all||document.getElementById
/ I0 r9 Z+ R- O' K! X# k; mif (iedom)0 u- t8 \ B4 f9 f9 q6 t
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')# h9 N5 o( u9 I& Y3 Z+ q
var actualwidth=''5 K( [/ H# w, C. _
var cross_marquee, ns_marquee
n" C# t- K2 Z3 F* U! g; e9 k4 {- I/ u- z9 d a
function populate(){
( ^# C9 j9 t2 z! X7 J* s5 Q0 @if (iedom){3 W$ l2 V+ ^( R& W
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee( [7 t- J+ g% q$ n
cross_marquee.style.left=marqueewidth+8
, V- k1 ]: s* v% r: ]% }6 ^cross_marquee.innerHTML=marqueecontent
$ N/ m _5 x& gactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
- ^* ^3 S1 f1 B4 t}
4 L. ~, d5 J0 P3 F- Yelse if (document.layers){; e D0 B; U+ M" R; O# j# |
ns_marquee=document.ns_marquee.document.ns_marquee21 |, N9 N* o- Q) z# W
ns_marquee.left=marqueewidth+8
4 }; n" K0 d2 ]ns_marquee.document.write(marqueecontent)( |( M6 v* w/ V% i' H; V N
ns_marquee.document.close()* E- b; g2 |8 \. n! ?; g" i
actualwidth=ns_marquee.document.width6 F2 V# J6 S8 W2 ]/ X D
}$ t0 a. R# W& D) Z& k6 ~! X) n
lefttime=setInterval("scrollmarquee()",20)( v4 Q9 G; O# R0 O u; q
}7 A0 k" j- d$ |* z6 M4 d
window.onload=populate
7 ^+ Y2 V1 S5 T" j! F5 J; Y& n5 N( i; d
function scrollmarquee(){
( G# z: M& I: ?if (iedom){
0 |- O- w* g/ x2 j. x+ kif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
$ t3 e& [0 ?! Q4 o4 d8 b, W' H+ f- ycross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
8 {+ w7 g$ n8 R+ A$ W9 B ^/ ielse
, A% X2 s. c6 t' J9 Tcross_marquee.style.left=marqueewidth+8- b7 Z& J2 C2 w* D: s$ |$ e; v- }! M
1 l4 q5 Z; ?* ?
}' x0 C# k1 Q- U) Z
else if (document.layers){& g4 |' i, f E6 a
if (ns_marquee.left>(actualwidth*(-1)+8))
: C( @2 o8 z; `& V0 K0 jns_marquee.left-=copyspeed
$ I; Z$ S! u" S2 h9 @0 W: pelse
5 C5 p ?3 L" I0 V) m6 Xns_marquee.left=marqueewidth+8
. [* U9 K% d4 ]: O$ @}
, F! ]9 _0 b3 H1 M5 }}
- N2 E; L9 B& ]: C
" ?" B8 V1 h7 N% s6 c* [if (iedom||document.layers){
8 Z- t, \2 k0 l" j. ~with (document){
9 J6 ~6 X/ ^% }" T9 r V) j8 Tdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
$ B/ @ x& g r4 sif (iedom){, m6 U6 ?" @1 a. L# e! d8 [* z
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">') ]2 E/ \5 W- Y* ~
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
7 Q0 E, V6 H& K0 t7 U% Mwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
" ?. B5 z! D( Q( q' ewrite('</div>')
, s8 R! |, p6 d+ D}
/ P1 F" l3 V- A& @. _( telse if (document.layers){
+ ~" Y) q# j7 Q6 t* Cwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')2 L! d0 Q0 d# A" j
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')6 ]* o) _9 f- H( k7 K# D& S6 ]
write('</ilayer>')% g) ]8 A- i9 ^7 `. r
}, Q: D3 r0 v* f P
document.write('</td></table>')
' O0 E$ Y4 Z$ \% B- ]) }6 g}, ~% N+ K, ]; o4 i, D" w+ }
}/ \$ j4 m$ {3 _ }1 k
</script> |
|