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

|
网页之跑马灯文字特效
//修改宽度
) O- R; \ E& X# `& b3 Nvar marqueewidth=300# E0 q, Y1 C" L- r
//高度3 L, l- [4 ?2 G0 W z
var marqueeheight=25
% t I! t( {/ X2 h//速度(1-10)' X/ v& \+ |0 N: q7 C" G
var marqueespeed=3' w) z& N# n$ U" N+ A
//背景颜色8 s( }/ Y4 c+ L- b+ [8 U: P
var marqueebgcolor="#FFFFFF"
" M- I; B% I; C+ Y//是否能暂停 (0=no. 1=yes)?+ Z: [: h3 _) [! x) u% d/ Z- R
var pauseit=1
( l+ \& ~! ^. X" u2 K: Y9 h! N5 L. i: f: o8 W2 p$ z
//修改显示内容5 I4 O/ N4 W- w( T$ H
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
1 u. x. t9 E, h# ^2 R P" Q# A
) [0 ~$ Q# v% s4 C3 k; _" ~" k8 D$ i* |: ~: I* A* x; n( q
////下面不需改变////////////
. W; g" B# o5 T& A: v4 ^' {" p1 L! i( w, A1 h2 J
var copyspeed=marqueespeed T! m( L8 U7 Z" P4 r+ y. }% ?
var pausespeed=(pauseit==0)? copyspeed: 0) C ^0 S, k5 }9 _
var iedom=document.all||document.getElementById$ p/ a0 v$ |7 Q3 H$ K( Z( U3 ~. S2 ?
if (iedom)
& i& m( q: `( d+ v5 G. S tdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')1 x/ C" [, b5 l( t4 Z- E9 H
var actualwidth=''/ V3 _$ z j* U! i7 b7 w$ G
var cross_marquee, ns_marquee. S9 b o) I) i; K2 d& F
' V+ @; t0 P3 j7 tfunction populate(){6 }. F' ]$ H7 C
if (iedom){# S* W/ }) r" X% }6 j
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
/ ^- R+ |8 R" n8 \# G3 ]+ \& j ccross_marquee.style.left=marqueewidth+8
) O5 K. S0 g& b( scross_marquee.innerHTML=marqueecontent
+ r# Y$ C3 ?1 T, ~" N; {, n% Xactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth1 m6 j+ L% U% s! k
}, L9 r$ g3 u1 P1 E
else if (document.layers){
# @6 p' b& g7 t9 o* D9 w& U7 ~8 Q( Tns_marquee=document.ns_marquee.document.ns_marquee2
# r; n7 K) }& h7 ?9 Ons_marquee.left=marqueewidth+8
7 @5 W X" n! J/ h8 K: k5 Kns_marquee.document.write(marqueecontent)
) Z9 J, G) w5 `+ B) q& `' Ans_marquee.document.close()
! r) [% c ?0 tactualwidth=ns_marquee.document.width5 U" j% w, L' |" U8 ^/ x% }
}
& r1 E" e& F6 I( Z glefttime=setInterval("scrollmarquee()",20)
2 C4 k% ?0 R# o. j! A}
- P. i2 _% b7 Q2 P1 Pwindow.onload=populate8 {) w' O* K# U+ {) p2 U; }1 a- g
+ I1 u) n( j" i( j! q! [- kfunction scrollmarquee(){
' t3 i8 y% O& Q C" n5 [9 w$ h, pif (iedom){
$ v4 k) B0 L( q8 i* Iif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
+ L- W5 ?% a) Fcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
* P$ x; A0 k8 Z7 Q P/ H2 U6 b7 kelse# Q7 f( Z, x. ]$ \
cross_marquee.style.left=marqueewidth+8
. y% t- T( E* H0 N* j8 c
- d: E/ [/ c9 g( l: r, i: Q( U/ Z}: E% W3 t) r7 B% L* `
else if (document.layers){
' {$ b. j: a% f5 k, Iif (ns_marquee.left>(actualwidth*(-1)+8))9 ]0 O9 t2 X2 f, W- Z0 C9 x" F
ns_marquee.left-=copyspeed( s! K& c7 g: p. t9 x5 _" q: u
else+ n" Z* P. e# m& N0 D/ S
ns_marquee.left=marqueewidth+8
/ \/ h6 G4 h3 X. R- f6 a}
+ Q6 S8 l) {$ W7 s+ m4 {+ L}- i" s+ _1 U) F7 Z n, Q
+ G" _; Q, M/ e2 l5 cif (iedom||document.layers){9 K# f2 e* u9 z. J
with (document){: R: ~8 E! b# o
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')! b; k0 F9 @ R& w
if (iedom){; H7 p& k( V( R$ l- |. u _& l
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')5 \2 k a3 E, n8 H2 Y
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')2 f5 _) ]- U6 l9 [' B
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
+ u1 n# y; I/ _5 v; _4 G$ |& iwrite('</div>')( T) }' e; J6 K# U( Q
}/ t7 r7 K. x" w9 y' t3 _
else if (document.layers){/ Z6 H) H- Z! z; @' u H6 ?
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
1 u+ J' h( D$ y$ ?6 Kwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>') b- X# m* }$ c7 |8 F. q8 |
write('</ilayer>')
0 v+ d$ j) y9 o. Z& S}
( s( W- u/ @9 [% Rdocument.write('</td></table>')% K- [/ Y4 k( I+ m
}
( r8 J2 I( k3 u& M' j}
9 G) e. j5 e+ d) T+ B+ A</script> |
|