返回列表 发帖

网页之跑马灯文字特效

//修改宽度
* c- f2 g! ^; Y( [. `% e: |var marqueewidth=3008 M- r! B; Q9 W& {* b! Q  B5 W
//高度) I9 l, v$ {6 t( T" a+ `1 y
var marqueeheight=25
3 D2 W5 J. |6 d) w//速度(1-10)# h$ l- ?: B) s  \* J
var marqueespeed=36 P/ A& A7 h; \  v6 J
//背景颜色; B7 n; t$ W& ~% y1 z
var marqueebgcolor="#FFFFFF"
1 X9 o7 s0 h, @$ r//是否能暂停 (0=no. 1=yes)?2 G% {3 J# r. c) q
var pauseit=1, r0 |# E! J% a3 w* G+ s6 I
! G& g- \; m1 e' |5 C: ~
//修改显示内容
5 u* @7 Y' j% ~; a/ P; Fvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'( U& r4 B7 L5 R

0 s$ e; Z7 E- A* s, h9 S: F/ A9 {% g1 ]* O6 C" B3 g
////下面不需改变////////////4 h) @8 S% w( Q5 q4 q8 c

% i+ z" V& [  r; ]var copyspeed=marqueespeed
+ ~! S3 I+ O4 v1 e4 qvar pausespeed=(pauseit==0)? copyspeed: 0) r3 k- ~5 p, U6 I
var iedom=document.all||document.getElementById6 y$ N$ ]3 e. c% {
if (iedom)' N! ^5 Z4 m% u6 `, }
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
% i* g+ {& w+ fvar actualwidth=''
5 G' q) ^1 L+ O5 h1 }+ Tvar cross_marquee, ns_marquee
; O7 E& R, i) X1 n% `. J6 j" f: O* J7 k: D1 I
function populate(){: J. h) Z" o% w2 |
if (iedom){
% A, Q; J7 U& t( _cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee& @. \1 l7 I4 N) E
cross_marquee.style.left=marqueewidth+8
$ U  m, L# p' ^! }7 |cross_marquee.innerHTML=marqueecontent
8 o1 x1 |2 C! v. w# T2 T. ]actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
  c) C0 l% |7 A, P  e}
; o4 B  d. |$ U  v6 d( [. \' Delse if (document.layers){4 ]4 x5 V: G! g
ns_marquee=document.ns_marquee.document.ns_marquee2
/ x  `% c* Z) E) l6 Ins_marquee.left=marqueewidth+8% c: i* R5 x$ ?3 K( N# s; x
ns_marquee.document.write(marqueecontent)! _! A8 N( i+ T& y
ns_marquee.document.close()+ d* t: P0 {4 ^9 N& W5 K
actualwidth=ns_marquee.document.width* h& ^# [) C. k2 d3 X
}
. e3 B# C4 b4 ~& `8 P# j1 \lefttime=setInterval("scrollmarquee()",20)) j9 V5 ^: K( o; G9 K
}
5 O# L( T/ H% [window.onload=populate. X: }( N- }; u) Y3 X
. q: o4 Y' I$ Y- ?; T9 M$ f1 z
function scrollmarquee(){; H2 p  p: Q/ y; W3 W
if (iedom){
4 B$ Y9 H0 \: ?' W$ U- |6 wif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
5 s* t; i! t' s, O4 Xcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
7 Z; s% l' Z6 N, X% S2 W% Gelse( o1 E. ?1 t5 O( P5 Q5 z+ D
cross_marquee.style.left=marqueewidth+88 }. l3 _5 N" \+ q

  n4 `) g3 O; B2 M7 }}  J/ J' T# b4 x$ T& g: X
else if (document.layers){
$ k/ Q: G0 E1 J4 E( \" hif (ns_marquee.left>(actualwidth*(-1)+8))
# @( E3 e& C  w/ G* o: Y( yns_marquee.left-=copyspeed
6 s4 h" P8 Q% T( h$ S; ?3 {" Relse0 `5 m9 C4 ?, y5 r4 X4 g0 ^; E
ns_marquee.left=marqueewidth+8* _( M# d( Z+ `, l) H* \
}
0 c7 W( w: f& `* \; s# Y  U( y0 O}3 s0 @! s' u  h$ {1 L4 x
6 ]6 t4 f" {; c# D
if (iedom||document.layers){( }# Z  a3 ]" g
with (document){! S$ y1 B( d" E3 Y9 e5 ~: l7 L
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')) r# t: v; J, C( U' [5 o. c( t
if (iedom){
, g1 A' s) o0 \4 V  ?write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'), t3 q) h% p9 B
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
) Y0 _& n/ M! Y* N% R3 a* kwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')+ c+ G% G! ]3 b2 z3 @( K0 z- h
write('</div>')5 \- p# u& L3 H$ `/ M5 v/ Y
}9 j. W! {0 M! P; r/ W! Y
else if (document.layers){/ ~% M) A2 G+ [7 _
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
$ n' S( `; _2 W( h" s1 r6 `# d4 dwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')9 c! d; s$ Y! N  j) D7 C
write('</ilayer>')
6 e' N4 ^+ B6 e3 o8 B" L& L, K}) o+ |/ {! P9 f7 z6 ?
document.write('</td></table>')! ?: O" z8 |. H+ ]2 S" ~0 l6 m" }
}# Z5 H* d/ P' ~7 s" e
}
( d1 l- E6 x1 S- ]0 l. L' c0 j2 a& B</script>

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