返回列表 发帖

网页之跑马灯文字特效

//修改宽度
2 H/ A. ?* e1 Y( c: p& vvar marqueewidth=300
; {/ P9 p* v) z# a# C$ F2 |//高度
: W+ {; `; y, G0 Qvar marqueeheight=25
4 S: |7 [* Z, I  ]' @; `3 h//速度(1-10)
8 e" X' ]8 E  k7 hvar marqueespeed=3
7 r' h# i# T+ z. u. G+ i//背景颜色
- _8 y+ q7 [) B/ z1 u/ ^var marqueebgcolor="#FFFFFF", }! D5 G" s$ v( w* N
//是否能暂停 (0=no. 1=yes)?
. U- J0 S. @  m+ F1 s1 }var pauseit=1  O  I" `8 L3 C1 b" ]
; ]7 v8 P: E' I- m7 n! d1 H- M2 B
//修改显示内容
* [  y1 w6 n2 h- v+ U+ c* avar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'4 t& F! `4 l' B$ W
" G% E3 q; V" N# h# i4 H5 F* A2 o

- {2 p7 j/ p* k1 \) |////下面不需改变////////////
3 ~- A4 h" l8 s2 o1 M4 j2 f
# o( `8 ]+ W7 mvar copyspeed=marqueespeed
& i% f: V' T" Wvar pausespeed=(pauseit==0)? copyspeed: 0
- H7 X  V' f$ Y4 H# z9 Y6 w! G. H  dvar iedom=document.all||document.getElementById! ~9 k# R9 h1 d/ D3 O+ B
if (iedom)
$ c$ l* C+ w) X' l$ fdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')/ G; W9 m( y, j' E% i
var actualwidth=''
* k* f7 t7 @4 Q  J4 Dvar cross_marquee, ns_marquee" D! A" \, f# L  m' x9 q( v
  R0 a" F# \' s( H) s/ u
function populate(){
/ j! O7 ~+ @" n7 kif (iedom){
1 V$ o/ A5 H) ~& j; tcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee( k/ H" y# l/ v, q# Z, ?5 X
cross_marquee.style.left=marqueewidth+83 e3 Z) @+ f2 B/ P7 L+ u* S
cross_marquee.innerHTML=marqueecontent
2 v1 V+ r4 M9 V% ]: m* a; G1 pactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
) o, _3 Z' y. i}
' w/ T  s/ h7 |$ i! }else if (document.layers){
: l) q' O9 H$ _) J) K) Rns_marquee=document.ns_marquee.document.ns_marquee2
% R8 J* E, |7 B& Z: N4 @6 }9 Zns_marquee.left=marqueewidth+8
+ h, T8 j1 R4 F& ons_marquee.document.write(marqueecontent)9 X6 \1 G/ [0 }- U
ns_marquee.document.close()
7 y- D$ u- k' Q8 }actualwidth=ns_marquee.document.width
  {3 ~, Q5 }$ l- j. }}) Z% w4 ?8 [, @0 s: H7 Z4 K
lefttime=setInterval("scrollmarquee()",20)6 g7 V% @) `& E- Q3 v
}% E' x: b; E  |6 n
window.onload=populate
9 e, v/ S' t. A) Q. i
' @0 ^9 h/ V" Jfunction scrollmarquee(){
, ?0 A/ {: @" P5 \$ ?9 f; h2 G7 yif (iedom){
  ~- w% h& T1 w, R) |, {' Sif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
$ O* r8 U( U7 K( n! ycross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed' }; b4 q/ T" z7 K8 }
else* n  d1 f, ^& S: a
cross_marquee.style.left=marqueewidth+8
) {& h( b2 L/ ]# T2 t- X# G3 X1 o; L0 a5 h% {
}: u+ I) B& l5 N1 l& n' s  |
else if (document.layers){
0 t8 Q2 k' q7 Z: ~if (ns_marquee.left>(actualwidth*(-1)+8))7 V. u8 v' s$ g
ns_marquee.left-=copyspeed- w0 U& `" c1 i! Y# j$ }+ b
else
9 B( A( n4 `# q9 n0 \ns_marquee.left=marqueewidth+8
8 c$ A( Z- c$ I  M0 j1 S3 @}" T% l9 i( w8 T
}
! y+ u/ U. m( e4 J) [7 ]& H
2 \! z  l4 g7 A. k8 o8 v1 W  Tif (iedom||document.layers){& s5 G* d. r" c/ H+ C+ B) S5 v+ J
with (document){
" N5 K0 f3 P, V0 {' odocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
/ Y) T, D8 G, C# D* `if (iedom){
4 [$ K, R" ~8 U: W  |write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')9 O% Y. `% `- g) [3 g
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')' I5 {8 C$ v- @! `: \6 V
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')# c% v% g" j% y# [/ _9 F6 L
write('</div>')
" O, ^$ q5 o% @" m) b- c3 A}0 A! t# D9 U6 X3 P
else if (document.layers){! o1 @  h% H' c2 X" A/ ]
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')+ k; H3 T; N) Q: O8 e9 `8 U4 K" o* ]
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'). X  B/ Q: Y) f4 t
write('</ilayer>'). Q! e8 d* f( k: O% ^1 p8 ~
}
5 ?; l' t: c6 J6 q! pdocument.write('</td></table>')
. f/ m" J' ^7 A  {0 J: h}
( s1 x! |9 Q% Q$ T7 R; R) \}8 s5 f3 a$ N7 ^/ ^6 b- M
</script>

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