获得本站免费赞助空间请点这里
返回列表 发帖

网页之跑马灯文字特效

//修改宽度
1 {# o6 s8 E6 ^# V# p+ Evar marqueewidth=300
/ k% K' i, j% P( E, |7 q//高度
: F% j+ L; g4 Y7 U1 ]" Qvar marqueeheight=25' b. `6 p& B4 H1 p
//速度(1-10)
& k8 f, p' k6 o9 f# q2 w- P  j. G* Evar marqueespeed=3
/ z8 k: A% [2 R  Z9 I: @//背景颜色4 i6 G  G6 b7 {* H2 Z& }9 ]
var marqueebgcolor="#FFFFFF"
$ S! q5 _6 M* `' i+ V//是否能暂停 (0=no. 1=yes)?5 f  j8 ]% G) ^9 F! E: a# {4 M1 B) I3 |
var pauseit=1
( i0 M! M6 m! G3 p
5 W% ]* G( q: \, S) g1 L- I//修改显示内容2 r# @$ X3 P  O- v6 f
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
0 a1 D6 H- U# l* I$ E; w0 x& o% J  k4 D

1 _0 p* \. ~' t/ U  B& u9 M8 }////下面不需改变////////////
9 C5 N/ n# {: q, q- i9 `( y: P
5 h3 [/ b0 k; B/ ^$ I" i& g1 Vvar copyspeed=marqueespeed2 s8 z7 Y% L3 i5 j( p
var pausespeed=(pauseit==0)? copyspeed: 02 \! j0 \2 H0 `$ Q  {
var iedom=document.all||document.getElementById6 \% A! \* a* E6 m( n$ X  c' o
if (iedom)- S0 {. A1 B; [4 k6 X' J$ M6 d
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
' I6 X, c/ ^# d5 B- yvar actualwidth=''' ]) P7 }% h5 F- r' `- T; j, O
var cross_marquee, ns_marquee
6 z1 F' K0 I+ I6 d" \9 B, [1 d
( z( S5 ^. k0 c& |! N' Y1 ]function populate(){
+ \0 n3 F: M" K$ P3 V( S  Hif (iedom){4 s9 ~( [# s+ B% n7 h' X$ R: L
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
# X" `' P. M! ^3 l& h  ]7 l+ v4 Zcross_marquee.style.left=marqueewidth+85 O( p& u% z, v  @5 `
cross_marquee.innerHTML=marqueecontent
) r! [. ]5 I) W2 c. l  jactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
% T0 Z- H, g0 ^" M}$ w, }' W* r9 I5 Q# G. W
else if (document.layers){0 A# g; J. R( ]- L2 Q5 s
ns_marquee=document.ns_marquee.document.ns_marquee2
- m8 k9 K; \/ R' T# g" T( _ns_marquee.left=marqueewidth+8
2 I8 W) `, v( x& `- \ns_marquee.document.write(marqueecontent)' ]3 Y* _5 t9 N& D* T6 I0 ~
ns_marquee.document.close()4 |' |- B# W9 X6 z
actualwidth=ns_marquee.document.width
# [+ i4 P! a$ r1 r0 A}
  N6 y  T/ s: llefttime=setInterval("scrollmarquee()",20)7 L0 e& G) v  b5 ~  T$ Q
}6 `) @/ l3 K( c% q
window.onload=populate9 L4 ^* ~7 r" g% n; O( \6 T

- d$ S  o5 }/ g/ G0 d, }6 efunction scrollmarquee(){9 ]$ d4 X# \, @7 g9 q( Q6 h# j5 b) {
if (iedom){. h; c8 h$ X( |7 y
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))2 ]4 y7 h) K) K
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
1 [  z( E' C, H: W& relse8 p& }4 Z8 V! M! _+ p3 U+ u
cross_marquee.style.left=marqueewidth+89 F) |! \1 |" n% j0 w, q
, A: i0 n1 s$ Q$ y6 p/ n
}
5 ~* _& d7 u* Gelse if (document.layers){5 N( K/ p9 L" I% C& @6 @4 Q! M3 V, C
if (ns_marquee.left>(actualwidth*(-1)+8))6 L9 L  p4 }- @2 {% L! A# I, N
ns_marquee.left-=copyspeed
% }( v! J( f. a! B6 n7 relse
# i1 G( J. y: }4 w8 dns_marquee.left=marqueewidth+8
" Y. O! v2 ^: I0 ?7 q/ D, N}
* _+ ~2 E; q9 y6 y8 t; i}
7 @3 O  k/ {. c% F' ^% |$ e/ |7 H+ ~5 @$ N3 o
if (iedom||document.layers){* b5 J) i$ O6 b$ ?
with (document){  M- o! N: D8 C2 j
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')5 Y" @8 y" V$ i
if (iedom){
0 h6 y4 S% q7 K$ R2 Awrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
. ]3 a  Y) @6 t  [7 g  a1 @write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
, Y5 ]& u, I1 [* `/ i6 mwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')- t' r2 N2 ~6 ]& V0 v0 b; q( O$ z
write('</div>')
2 q7 ]' y- ^3 @3 K+ g}
$ U# D* y, n( P1 D. G& ?% v* Celse if (document.layers){
4 s* ?) Y/ K9 Zwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
. [7 L1 ^3 W$ ]! E3 uwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')! K7 ?/ I( E/ `/ w0 F+ ?
write('</ilayer>')
4 J* m/ y: q' c3 O! J/ c8 T( Q}
% W# j$ V1 Q2 X# F1 i" U9 idocument.write('</td></table>'); N/ l" ]( ?$ j  S  {- _* s
}
3 a/ l8 @6 k# ?' S}& v5 w3 K8 ^2 i2 e: G# ?
</script>

返回列表
【捌玖网络】已经运行: