返回列表 发帖

网页之跑马灯文字特效

//修改宽度
6 u. D" S- y# H) e3 vvar marqueewidth=300* [; G$ d4 w- B0 {
//高度% d$ Q: j% _: x3 Z0 x, o& M6 \. U& D
var marqueeheight=25
' t! Q9 ?! e5 e//速度(1-10)2 m& d  [8 d: Y; l
var marqueespeed=3$ r. Z1 T% P% @( Z( d1 I
//背景颜色
6 g* Z; Y8 k" G# wvar marqueebgcolor="#FFFFFF"
8 D/ T- J, S% p2 z3 R4 s//是否能暂停 (0=no. 1=yes)?1 ^, U' c: Y; s% Y/ `0 p5 q2 u, F' f
var pauseit=15 {5 R1 T* i9 h( X- c" x
) b9 Q; o$ k, P3 e; @- Z4 ~# j
//修改显示内容8 P: m, z# ]- O; ~* d% l
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'9 Q6 M, h# N. N6 n( j9 s

, ^! e6 g+ B% [2 W' t6 Y$ E
+ n. T* M' Q) o0 i////下面不需改变////////////
9 O9 s# u, \4 P8 O
; T  N  b" Z  `: `2 D5 Qvar copyspeed=marqueespeed" j% S- F0 z4 \- Q4 U- ]
var pausespeed=(pauseit==0)? copyspeed: 0
1 j  ~8 k% f, ^, W$ J6 y! z- Xvar iedom=document.all||document.getElementById
) M: K) L6 a9 G" c$ T' s, ]if (iedom)
3 q3 [" V5 n9 f4 d7 x) Tdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
! b9 N* I, z) ~var actualwidth=''
0 j! s0 m( [2 S( g# A$ [& T, T1 h8 Cvar cross_marquee, ns_marquee( E6 e! a( I& l8 e* S  R# A7 }

# Z/ {- G& r8 A( Q4 L: }+ }6 Nfunction populate(){
" J0 Y8 o' B* u. p  Eif (iedom){; ]; x) R7 V  c$ b2 z
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
5 v$ n. z- u' ~: R1 Ccross_marquee.style.left=marqueewidth+8
$ O. f( t1 e: ]- bcross_marquee.innerHTML=marqueecontent
4 i# j0 ?3 u" E0 j: k: o: `actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth. Z: |: O& ^# u2 J1 ]' @/ H1 x
}
' \& l* ~; W" m! d- e1 c& melse if (document.layers){
+ A/ Y1 U' F4 y+ X# j4 t! e3 hns_marquee=document.ns_marquee.document.ns_marquee2& o6 @2 g7 K# }
ns_marquee.left=marqueewidth+87 h" c) {! x3 n6 T' C, A8 B+ y/ l
ns_marquee.document.write(marqueecontent)' f' S4 A: _% q
ns_marquee.document.close()9 j7 J: ?, r1 G( V' u! ~% J
actualwidth=ns_marquee.document.width) Q0 E7 @# w. d+ Q; v
}
7 y3 Q9 W1 J+ `7 N. }lefttime=setInterval("scrollmarquee()",20)# z7 a. A& g6 X
}( l4 q/ Z/ r3 u% p; I: W
window.onload=populate# ^5 @% o0 p7 ~" z

# Q$ m  h4 O& {9 K/ X6 pfunction scrollmarquee(){8 @9 T, j7 S% n, H  T
if (iedom){) u( k+ S# Q8 k
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
! Y; T7 }* j/ a! z* l! l5 lcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed7 v6 z0 _7 L/ m3 G8 a3 d5 J) t
else
# d2 `) N  x/ {; @cross_marquee.style.left=marqueewidth+8: Y7 q5 G! M/ {/ Z; s

% ^0 x' B. R7 D* a9 X# f8 J}
- {) {+ E9 j& w( T  N+ h4 H$ ]else if (document.layers){
. ?5 _' ^1 r- A9 R) h8 Jif (ns_marquee.left>(actualwidth*(-1)+8))7 b( \5 Q( U" ]1 w  A' |0 \
ns_marquee.left-=copyspeed+ t2 h' d- M8 V$ n: \: y. x
else
* x5 ~) V$ t3 G# D3 Uns_marquee.left=marqueewidth+8
/ H* ?% |& {  U7 Z}+ g' J* d& T. S' h
}
' v& E% Y- r% A% A
5 s  [9 W4 _( Q: o! k" v- z$ D0 yif (iedom||document.layers){0 V, r+ \, w4 I+ }
with (document){% |. t1 o. M/ d$ [' [/ B3 k
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'); ^* Q0 D3 q8 |
if (iedom){& s0 }0 B6 v! b* P/ ~8 ^
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
0 C& }+ l! h# h/ z0 B, _write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')9 z( U. H$ V$ W+ x# d2 M2 N" T
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
6 b) P% z% I- U6 G3 h# }) n3 y1 Pwrite('</div>')
" r2 M! [, B# M3 t}7 O: D: W+ c! k: l+ g
else if (document.layers){+ {, ]( ]! h0 P7 S" v# s: E+ A
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
2 s, w: T: X1 V' Y) {5 hwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'). P0 g9 A, o, [8 _/ l1 C# L
write('</ilayer>')
9 `, {9 j, p+ O0 G, A}
- Z$ L$ x  s0 Q) }: e7 M! \document.write('</td></table>')+ e+ _9 B6 J2 y" Y6 I+ Q, A+ ~
}
, S4 S9 c" I- n( D- s  n) G}' I: ]( D/ {% K
</script>

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