返回列表 发帖

网页之跑马灯文字特效

//修改宽度+ \. {1 |' @8 r8 S* O3 h. R3 e6 u$ ^6 H
var marqueewidth=300* d* {; e6 w) R3 G) j+ l' R
//高度
" ^% ?, m5 L/ S3 O6 W6 d. Vvar marqueeheight=25
9 W) ~) T' m& L( @2 F1 _//速度(1-10)  o" A. E$ }3 }6 u0 U
var marqueespeed=3
5 _* U# \' g! b4 e4 ?//背景颜色
/ ^6 C+ \9 W! _$ {2 f) |* y1 O/ zvar marqueebgcolor="#FFFFFF"! W" q! E% Y7 z( d
//是否能暂停 (0=no. 1=yes)?
6 T0 C  l& r3 p7 e9 ovar pauseit=1
+ K9 A+ _/ L; f! k6 f9 E% J' ]- N7 R+ V% d8 C/ ^0 i
//修改显示内容! S) j, [7 g6 j
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
; y- a3 y4 r5 E$ D8 \  E' D3 \2 Y9 @- I- v6 D

  U* `- N2 J' F////下面不需改变////////////2 ~9 G. [& E, @" G# [, P+ Q, {) `
% U* w, z9 Z: H9 e) u
var copyspeed=marqueespeed
7 S* g1 i, _  G6 ~var pausespeed=(pauseit==0)? copyspeed: 0
" l9 l! ~, N( q/ l% Svar iedom=document.all||document.getElementById2 |/ R; w- P  h0 M# u
if (iedom)
3 T) ^; _( C7 kdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
# }; S( f9 s7 s  |* m. M/ w  C( avar actualwidth=''" Q$ ^- Z+ I/ G2 \2 x  X  Z& v; U6 L. c
var cross_marquee, ns_marquee7 e2 `* w. n6 }& g0 [% q# c/ S
  K  t# V" ~& M% F/ `& i- ^
function populate(){
/ d7 Q' ^9 G2 |" H' j4 Q+ V$ D1 lif (iedom){
4 V  p: T! {3 k6 H: q7 ecross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee( \- P; Z* K$ @6 e
cross_marquee.style.left=marqueewidth+85 S2 G* p5 N1 l0 z
cross_marquee.innerHTML=marqueecontent/ w2 q7 _0 G8 K5 B4 l. S! F
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth% Q8 h/ j5 ~- e- R) }+ Z1 a
}
) e4 h$ `5 S5 y2 ?: {else if (document.layers){
1 s( t. y+ c6 _8 @ns_marquee=document.ns_marquee.document.ns_marquee2
6 ]5 q& @: `7 N$ P$ E7 ^9 t1 Ans_marquee.left=marqueewidth+8
9 i$ l: f. \) wns_marquee.document.write(marqueecontent)) \4 U! H! n( P- k$ R1 H: X
ns_marquee.document.close()
3 t" N$ |* k2 Y0 e4 Ractualwidth=ns_marquee.document.width
5 P  K# j1 R( t& {4 n}. T1 n) H/ i5 v- H: x) l( ~  o" [
lefttime=setInterval("scrollmarquee()",20)
1 a. n9 r( V) }- l' ?( C}
3 W& C1 R; B* s$ Twindow.onload=populate2 s* u% a0 `& U1 Y; o

/ Y% z& X5 k6 E* u$ tfunction scrollmarquee(){
& t" o) K, ?" l: uif (iedom){
) T4 w/ W* P: ^0 Q8 ?# R  G0 j1 p3 d! pif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))$ o1 ^) i6 a  T5 \6 O* n
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
9 P) m+ l! _6 `4 S8 t* ~  F% E& ielse
9 D7 t" \2 ~9 \& a3 a- Icross_marquee.style.left=marqueewidth+8% l8 q0 ^. S) t+ a8 O5 H: c) Z9 b

" C/ d5 t8 K  n% u5 T1 e}
* P/ R" V4 _  A2 S: n2 ]else if (document.layers){3 {7 L0 m& k3 J5 _  Y. s
if (ns_marquee.left>(actualwidth*(-1)+8))- r+ G. d8 _% C- j! A, Y
ns_marquee.left-=copyspeed
3 u9 R" e9 z0 Q2 xelse
& V0 I' [( Q- w4 ens_marquee.left=marqueewidth+8
, L$ p# B" U) g3 H& ]}& I9 U" X; L: O. Z0 i$ m0 {
}
& D) Z% j9 `8 L/ S) x! e! R9 g# x
; L5 [. |7 {* L! j2 D5 x' vif (iedom||document.layers){* _0 p; {' K2 k' R; \3 G
with (document){8 }6 @1 o# ^* b, a$ @4 o
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
& h2 Z4 c; B1 P7 Uif (iedom){
, Q7 q+ A/ ~. F! A' M0 Ywrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
& }7 j& n! z& t* I/ Lwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')/ a# u8 f3 h8 R5 Z
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
9 @7 u, {, ?- {. x& ^: \# V* ~write('</div>')" Q# h! h& {5 G2 H
}
- J, _1 \# D- h: J5 |else if (document.layers){
$ ?5 x. |8 t7 \* mwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
; @; _, J& f  ?5 @6 t; Lwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
( T- ?6 U7 F2 l3 B; |* \0 o. N$ }write('</ilayer>')
( F( \8 ~; P3 s# ?}
3 I, @5 o+ M& P5 g/ u  X8 H, S2 ndocument.write('</td></table>')
7 |' |) P) Y$ R! i}; K8 {% a+ ^# }6 m
}
- ^3 j1 s) V! V! B9 q0 [& m+ M</script>

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