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

网页之跑马灯文字特效

//修改宽度
# t( o: L! B7 T1 Avar marqueewidth=300
+ y5 ^! Z+ F' g- N( t  I//高度' L: K% A3 f* s$ P
var marqueeheight=258 @( N3 F/ s7 i( F/ L
//速度(1-10)6 [& e- m! }% x' X" V, Z
var marqueespeed=3
" d2 t9 i" Z9 `% B//背景颜色- `% v# |5 n9 t/ v6 q$ v$ C, u. w! a
var marqueebgcolor="#FFFFFF"1 A& o5 \+ J+ H0 d
//是否能暂停 (0=no. 1=yes)?# c% `  U) G; ^% U$ l5 a
var pauseit=1
7 u: x" j2 b5 @  b. @' P9 a
/ Q6 ?3 {# u% Z- v//修改显示内容' ^: e% I3 L+ p1 @. F8 C
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'; |5 d5 \9 e7 [2 H. X8 u$ h" K* D1 \) n

2 x0 Z6 N) R/ n1 A. i$ m: ?' G  h" o8 J
////下面不需改变////////////$ a& T6 a4 I! g/ p3 }5 l+ |- A

7 z7 T& R, ^9 h7 \9 l) {  fvar copyspeed=marqueespeed
4 U- v, O# [8 H) }3 ovar pausespeed=(pauseit==0)? copyspeed: 0
. Y1 r5 k0 c6 ]4 Y6 ?# q8 }' M5 nvar iedom=document.all||document.getElementById; s8 S: J9 O+ O1 v, q1 c; d% Z
if (iedom)
/ q7 j3 s9 t0 pdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
7 U! K8 o: \7 g: {- pvar actualwidth=''
3 S6 m. _: e: C/ d$ Rvar cross_marquee, ns_marquee5 F0 `3 Y  u) \/ K+ a0 o
. B% \! ?+ s$ g
function populate(){
+ l" u$ w4 o0 eif (iedom){6 L, e" a4 f+ o; m1 x
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee( w1 d3 ]  w. z. R6 M
cross_marquee.style.left=marqueewidth+89 A$ Z. [8 C* B
cross_marquee.innerHTML=marqueecontent, ?$ J, ~( T/ ]' M& T, r$ g
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
6 @0 r6 `8 k+ y" |6 v1 p}# R8 h* x2 S, \" B0 `; T
else if (document.layers){
1 [1 _8 r. z9 O6 w6 jns_marquee=document.ns_marquee.document.ns_marquee29 s7 l- z* |8 W% }; z( O1 {: d
ns_marquee.left=marqueewidth+8
* [' m3 H) E# C# K7 p- F2 ons_marquee.document.write(marqueecontent)
2 Z% G. W2 {( ~  `& S7 Dns_marquee.document.close()
0 k3 L, u, q+ Z1 ractualwidth=ns_marquee.document.width  x/ i. C( f1 t' P
}
  e' }, Z6 k  Mlefttime=setInterval("scrollmarquee()",20)
! p; M4 w! m; ~9 |}5 u# W' u; x0 z. r7 a# w
window.onload=populate
, ]1 t! B' U" S- n' P. k5 x
/ R; M2 V: g. i& f/ jfunction scrollmarquee(){' d4 W, u2 R, ^: [3 Z! \; R2 ]
if (iedom){
3 ~  K  S5 A6 J- Dif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)); E6 U8 b, b6 o# V# |
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
! h* x, x" o% b7 h: T* zelse
  m( o# }4 ~; ?* bcross_marquee.style.left=marqueewidth+8) H: A( s! [; X2 a2 ~" G# U
  q( G, @, b& ~9 j2 L* ?' O
}* q# ^% r9 N' ^+ v
else if (document.layers){
+ G) a0 g0 ?! Hif (ns_marquee.left>(actualwidth*(-1)+8))
& b* _3 a' H' n& u8 Cns_marquee.left-=copyspeed
3 N  l" z1 [  d  `: q' b/ Pelse
; ^$ l) P3 U  Q/ t) Sns_marquee.left=marqueewidth+8$ J1 A! K; A: x* v5 c( N
}5 J! t0 s; w4 Q: Z; n) f
}/ D' p7 f7 ]8 g5 Z
- O1 X* H1 l4 v$ G" }) s5 m
if (iedom||document.layers){
1 I- \  R- e- Nwith (document){
# O( `( y6 ~+ V, P7 t8 Wdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')+ h2 Q/ ^1 J% W9 i5 W) o
if (iedom){
/ a) n% |; g4 mwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'): D# l- S2 D3 I* ~6 y# d
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')- \+ \4 H* F: x  R6 L
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
8 G0 c+ A8 f! U" A5 T* i& ~write('</div>')0 o8 Y* z7 t8 z
}
$ W( ~+ I; G8 }- x, v7 ~else if (document.layers){( p6 y5 V2 Y( q: @1 S8 U8 \
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
$ P8 j* W& l1 B# V: B- p1 qwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
# |. J3 n7 `* h# W& D3 `write('</ilayer>')
3 e( Z2 H- s& a1 y1 G0 K- ]}+ u/ a3 u1 C( I$ Q$ W
document.write('</td></table>')
0 I+ h/ @/ O* l  T& Y* [}$ m# _, O% A7 j; T
}* {. `+ P  S6 \" T0 Z$ Y1 }
</script>

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