返回列表 发帖

网页之跑马灯文字特效

//修改宽度
8 |( p& a, d. N- w$ y9 L1 V. Avar marqueewidth=300" U7 |$ M* @* ?
//高度
  C4 W6 |" Z6 s  }! \var marqueeheight=25
: U7 c/ j) p1 H6 F; |- L//速度(1-10)$ a& p) V  m; w3 ~% u
var marqueespeed=3& m5 R- `1 f/ _1 [* a5 B' ?, D
//背景颜色! }! f* R% y; @; K- z
var marqueebgcolor="#FFFFFF". N# M8 x5 _  M+ [0 L' G
//是否能暂停 (0=no. 1=yes)?& D4 n3 M" }( ?8 L1 ^% z
var pauseit=1$ E$ `/ A+ I! v9 i/ K& m$ j/ b+ B5 ~
$ X1 d. }2 M6 B
//修改显示内容
9 z% p. L) E* z6 l; F, u& nvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'1 \* O7 ?1 d+ W7 m5 l/ T
' V0 L. [6 L, `
* \1 N$ R; p6 N3 h
////下面不需改变////////////
1 X6 p, ~+ u1 G( u$ w/ b' m" s+ S. v: S$ J: q" }( N8 O1 ^6 d
var copyspeed=marqueespeed
2 M" o2 ~* z  lvar pausespeed=(pauseit==0)? copyspeed: 0* H: |, ?1 u* d  ^3 ^" i( Z% D+ a( B
var iedom=document.all||document.getElementById! q0 ^1 `/ N2 a4 Y! q
if (iedom)
6 y$ `; w: y  J; o# m' o( rdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
2 O  l1 W+ A% ?" Kvar actualwidth=''
( [  H' B& @6 H3 z6 l8 pvar cross_marquee, ns_marquee
6 F6 t2 U3 G' Y# `
- V2 o- f7 _  j& P$ u. ?. Bfunction populate(){
  @" h, A3 h, Z; X3 [) Eif (iedom){# H, L% B; e# R1 K3 W% Q
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
8 R" y: F& N. Lcross_marquee.style.left=marqueewidth+8( O8 w3 R! r# S3 n3 P9 F- u
cross_marquee.innerHTML=marqueecontent$ }$ f9 j  B% j4 @
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth7 Q* Y( C+ {  D" h
}8 A0 v- v9 Y6 w7 N' @
else if (document.layers){
( I7 |. ~8 O0 Hns_marquee=document.ns_marquee.document.ns_marquee20 x3 ?9 R* c8 a2 j' M2 q
ns_marquee.left=marqueewidth+8
: p2 X/ W) ~. ]& dns_marquee.document.write(marqueecontent)
% Q. J9 k# `' V  T. d% Hns_marquee.document.close()% f* M/ v) R6 i( I" x
actualwidth=ns_marquee.document.width3 D& z* ?* g6 G6 w! x3 Z
}
0 f! w2 o* F! i( {( Vlefttime=setInterval("scrollmarquee()",20)
( h, D% F0 b! ]- L& a+ ?}
0 t1 h+ ^3 R3 z9 Ywindow.onload=populate' r6 V+ u, `& p! }
5 m9 g- t7 H. l( \( Z! b: M) _2 n0 t
function scrollmarquee(){
' K/ s, ^# S4 G; y- Z# w! mif (iedom){
  S5 _5 ~! `8 [; Y8 K5 X  M, Bif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
5 T, e% s- U9 N9 k  L2 Ncross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed" @9 ^6 H- ?1 e) H) ^9 I, a
else7 K" h. b$ y# j! Q9 w$ u7 t
cross_marquee.style.left=marqueewidth+8
2 A1 h2 D( \% @2 h% r7 {
0 ]5 ^  [& V" M8 ~0 e/ C4 Y}1 O, E  ]+ j* {5 _6 ~# k( |
else if (document.layers){5 l. |5 Y; `" d( z9 w& u* k
if (ns_marquee.left>(actualwidth*(-1)+8))
1 w1 d: A# G1 g* ^ns_marquee.left-=copyspeed6 ^1 q0 X3 T  U6 j: W! x# M6 ^
else: Z! N% U" i* _# A- k: U0 i4 r
ns_marquee.left=marqueewidth+8! |8 p: k2 _9 Y: T1 W6 r
}6 K) k# }1 O. {/ \( f
}: D  S- l4 M6 Y. c8 Z

/ o8 g& |& w0 {if (iedom||document.layers){0 C4 f: F0 y  L( v3 f3 W& X
with (document){( [) G- H, z. D
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')/ d0 f+ f$ ?  O! f
if (iedom){7 Z( @! m2 O! W& |9 B
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
, t$ Y; [) w* _' Twrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')) s( P5 l/ _  J. l; c. U# U
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
% J3 ]/ W3 ^& _0 ywrite('</div>')
$ h6 k5 [3 W; _6 h}! Z* [8 d3 h8 S$ g5 X
else if (document.layers){
4 l( t4 z5 r# Pwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')9 I+ g. v, J, y  i# @
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'); v- W' N6 b, ]& o- ^
write('</ilayer>')
% Y* T9 e2 l, j  v! }4 T}* H% [1 y) L$ }% J" ~9 H! X/ f, Q
document.write('</td></table>')
4 o  b. _* k7 F}6 U1 _, ~+ _; G9 T; }
}
# I  K6 Z8 f, B* I</script>

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