返回列表 发帖

网页之跑马灯文字特效

//修改宽度
5 j2 J& q( E1 d) W! Pvar marqueewidth=300) @: W! L. z1 u, T4 a9 S
//高度
% i: k  }- U1 }) Vvar marqueeheight=25
7 W8 B5 _8 ~8 r  k- `//速度(1-10)8 e( m* d8 J+ _
var marqueespeed=3
+ z/ [3 Y( J! R! w: D- ~/ U% ~0 k: y//背景颜色
4 X& s6 X' {! R- C5 T* Yvar marqueebgcolor="#FFFFFF"
8 Q" F" c% U3 D4 T9 V//是否能暂停 (0=no. 1=yes)?
2 Y1 q- Q5 b- u+ _% T  T( [6 ivar pauseit=19 ?3 p1 k" F4 F: @+ S! O  e) Q6 P

: x' V* q! |! [; E1 X//修改显示内容% b  l# t8 q) r- b* O
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
" H5 W/ T( g7 K5 O, l- E8 l+ v
- H! U0 `5 p+ U3 N* A3 t: Z
2 z) z- _- R& B' S////下面不需改变///////////// H' E/ y. o$ w6 b

* ^: F9 R0 w! _8 n/ Jvar copyspeed=marqueespeed
, I1 ]- A) r: S3 [4 M/ [$ S0 Rvar pausespeed=(pauseit==0)? copyspeed: 0, W: I6 r0 p8 a5 t1 K/ l
var iedom=document.all||document.getElementById2 \4 z/ J" p2 T5 g0 ~, C
if (iedom)5 o! B3 a1 [% C5 Y# Y
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')9 K: G, u" m2 l+ H2 B: k% e
var actualwidth=''. t9 r) w" b/ y2 r! V0 i$ ~
var cross_marquee, ns_marquee- Q; l( Y- Q2 _+ h) A7 v( M

0 X& t4 b+ A, F" C# B# a. N2 Lfunction populate(){, L/ Y- y; g& @% H* ]- J3 U8 G
if (iedom){
- Z# `$ k& Y5 r6 }" K4 zcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee% m) t: g2 R$ z5 r5 Y
cross_marquee.style.left=marqueewidth+8
5 U# G8 ]& k0 ~/ Y$ a& d0 across_marquee.innerHTML=marqueecontent
. G. G5 n  |6 e% o  E) Uactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
% |$ ?: U6 Z0 E2 ?! e}) w# u0 D- q' {5 i& d- s2 q
else if (document.layers){. B& Y. O4 J( u* ], G
ns_marquee=document.ns_marquee.document.ns_marquee2: S- A5 g- F5 B0 G% Q
ns_marquee.left=marqueewidth+8
( s* R, z. C# F  z/ Y* Dns_marquee.document.write(marqueecontent)5 K$ l% X3 q8 L# r9 s1 F
ns_marquee.document.close()
1 O8 k) Q; m8 K2 p$ Q& g' F" U6 r& Sactualwidth=ns_marquee.document.width
+ A& Z; M# }! P) n}
+ m9 F' T* S% ^$ J1 v- {lefttime=setInterval("scrollmarquee()",20)
5 U: k+ \1 V" @0 O}
; ^( n/ Z( W+ M7 h/ v! `0 L2 ]window.onload=populate6 W8 I; b, u0 a3 Y! i( [' C
+ X" N5 U0 B4 ?4 o4 `( r; a
function scrollmarquee(){
5 Q& H9 U/ M$ n. P6 s+ ~if (iedom){! V: z& o/ ?0 J, z2 P+ l
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
" _! Y. e- X/ u: D; d( Y) Y& z/ |6 Xcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
4 A/ s# Z  t. B( yelse
+ J4 O; V# k& Pcross_marquee.style.left=marqueewidth+8* i* u( I3 B% A- ]0 X+ V- F( O

0 f6 c& t7 V) t) {/ O}! K0 k+ L1 f; }. S  t/ T4 [
else if (document.layers){) U$ O7 d/ \- }
if (ns_marquee.left>(actualwidth*(-1)+8))$ Y4 u+ P* S7 H. U5 d- b5 F
ns_marquee.left-=copyspeed$ d- ^. H0 S( {
else
! g+ x" a9 r8 N+ _ns_marquee.left=marqueewidth+8
! k: ]7 H6 Z/ g}
3 g8 z, T" q3 C; y/ Q}
$ p0 t, ^; M: `1 J9 ?9 l2 q; u5 l# y9 ^( s+ R  m1 d1 \& H
if (iedom||document.layers){& W% D! ?3 b* B
with (document){) E( a1 i7 `+ w  l! s" }# ]$ Q4 D
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
  d& E# _' ?: i, ?8 k% Rif (iedom){
/ H6 A6 E$ S% [) {! T9 vwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')# Z2 Z  }* x0 b3 b
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
, j9 X3 w. x  U  B! Ywrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')! x& r5 y6 }+ b( ~. n1 e4 h( |5 c
write('</div>')
3 M! m7 j+ I# C- D  D}
0 R+ ]4 ]; j& N2 @. uelse if (document.layers){
$ {5 _! g" v+ F7 X, T2 x: W3 Vwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
8 g0 T/ E% \0 H! q; R" `0 `write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
1 a/ l% K7 A9 `0 I0 qwrite('</ilayer>')  a( [2 q3 \! ~6 s4 ~4 r6 M4 K
}
% J1 {; h& v! P0 Z7 _( gdocument.write('</td></table>')' t; Z4 Q8 {  J3 f) M
}
/ ^5 H& p5 @( j+ Q}
$ _% w  R& ^. \& o/ @; N% ]- @, P</script>

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