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

|
网页之跑马灯文字特效
//修改宽度 F0 U3 {4 o' O. }) N
var marqueewidth=3009 N: T$ c* j4 N$ E9 k9 |
//高度
$ [+ H6 R, k: d8 e" evar marqueeheight=25# d ^ i$ x" U& { G" u g1 I
//速度(1-10)# e ?; U; A! d( |
var marqueespeed=3- ]3 Q) g2 x7 l
//背景颜色
. \: N- D, B. }$ i9 ?6 m7 Mvar marqueebgcolor="#FFFFFF"$ j7 O; k# N, h$ L X, s6 V
//是否能暂停 (0=no. 1=yes)?
) Y) I$ b, o5 Nvar pauseit=1
4 E8 @7 x( ^( j0 C% p# G0 p" j, e! ~$ ^' r. s
//修改显示内容4 U. p+ e5 H: I( O
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
! i& A$ F1 g+ R# C( F) Y* g- i% r5 l H" v$ t
* F E4 L: Q( o" X/ Z- e. ^* U: ]////下面不需改变////////////( ^# l5 J0 d0 a! i R
4 L# L" k" I2 X$ Y- bvar copyspeed=marqueespeed1 B& H0 q3 S( ]9 i4 |' b
var pausespeed=(pauseit==0)? copyspeed: 0) @0 G) [& h8 V" f8 N
var iedom=document.all||document.getElementById
: w# f- Q5 j. p3 I/ q; ~ _! eif (iedom)* @+ U6 e' k, y3 j
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
* O9 B5 Z3 R. i5 @var actualwidth=''
" J0 Q) Y( W B. x8 q- |5 ivar cross_marquee, ns_marquee1 ?( Z# o* w; F- l
0 d; e m6 [+ K7 y3 ~
function populate(){
; ~/ z; `; M6 @4 j( ~+ Mif (iedom){' h y1 f+ h+ X% y$ B$ u: ~
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee' N" n) h4 m2 @; E
cross_marquee.style.left=marqueewidth+88 N: e2 t0 z5 O u( U
cross_marquee.innerHTML=marqueecontent
3 b3 e: O* D, t9 \' b+ kactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
4 |- G1 c G/ v {- x; |$ c}
. K" m- b+ F! c8 J h& U8 Felse if (document.layers){
0 @4 V8 _6 V# R, ^ns_marquee=document.ns_marquee.document.ns_marquee2: }, E: @/ f- R! p
ns_marquee.left=marqueewidth+82 l$ I0 m$ e$ d6 T! j
ns_marquee.document.write(marqueecontent)% z# o6 @* J0 {9 Y7 z3 ?
ns_marquee.document.close()" ~" w+ j$ f) j( d$ Y# S) p
actualwidth=ns_marquee.document.width# I; c0 ^9 M# e5 B& F/ O
}2 K* l% w3 l A
lefttime=setInterval("scrollmarquee()",20)+ y- c1 Y, |2 w; c0 F: J
}! j: Q4 n2 ~! q1 j! j; M! `
window.onload=populate
' S0 t/ I0 { R: J& F$ C! n9 [: |% j, M8 V
function scrollmarquee(){ ]/ D2 h: C m; y. M8 p& x
if (iedom){
! g0 i7 j# L u- g! ^7 W* fif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
( }' g% l0 e3 B) }& Dcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
" k5 f" e* D' U" J: lelse
* `. Q6 Y( f4 ]/ Y/ m* b9 L% b2 ^cross_marquee.style.left=marqueewidth+8
1 t/ T1 j8 E, J5 `. x' v1 W' v$ C: `% t
}& F! |6 K/ h) A
else if (document.layers){' U1 N {+ ^4 J9 M6 I* i* ]
if (ns_marquee.left>(actualwidth*(-1)+8))
- U \$ v# C" Ens_marquee.left-=copyspeed
' u: Z1 X# N: E* selse- m3 L% P& H' J8 j3 `; {
ns_marquee.left=marqueewidth+8$ ]5 s2 L$ X+ m
}9 U, [( m# v0 t$ q
}
2 X5 g, p+ L) G1 D; W& ]0 k% M; \# q$ q$ [8 h: \
if (iedom||document.layers){
) U; [' D' B- `7 B6 q4 Fwith (document){
- ?) ?2 ]; \, r1 R, r! fdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
5 x* Q" ^" x% v' K8 @ kif (iedom){
1 k7 s" z9 T( L# |write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')) u) }+ m: k! Y; G- x3 V0 I( a
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
* q4 z: y M( e: f( ]write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
+ T0 ] ~4 x0 B2 u7 |/ ewrite('</div>')
% N2 z0 L# J9 t5 N}
! k' `) g c* j7 E; ]; O% _else if (document.layers){
0 Y2 A6 a, o2 _% i' |write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
4 I4 d# H+ N3 D* s! N; Jwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')' X$ ^& K; S6 E
write('</ilayer>'); o! N u, t/ x' o
}- C0 B r) a$ r" N" b
document.write('</td></table>')3 \# w& v: b4 T4 \+ j* m
}
/ C( @1 P z* \2 l/ p# _4 x}
* z6 |% S. a% {7 P' Z' c/ W3 p</script> |
|