返回列表 发帖

网页之跑马灯文字特效

//修改宽度
3 \6 N& |+ \7 l0 }var marqueewidth=300
  g+ H- R* P' @  q$ x1 D0 _, ?//高度6 [3 `* I' @& j4 V6 B
var marqueeheight=25& R3 z# }1 p0 l* t- e1 f
//速度(1-10)
0 C9 ?$ p( F. q# `- evar marqueespeed=3
% D! l3 y' p8 j//背景颜色- D- z7 m# u4 ]
var marqueebgcolor="#FFFFFF"2 q; r$ ]7 A$ e0 U9 \- @
//是否能暂停 (0=no. 1=yes)?5 x" c) I5 j2 _( e( O2 h$ }( C& F
var pauseit=13 p, k7 g1 D$ ?! r& K1 a

) K' E9 K% t. f+ A, D  E//修改显示内容
, a! M  I6 }  L- u& T9 u) Q; ?var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'8 m3 H  T5 t; V

' e/ M  b; t$ d7 C+ u, R# _
% ]4 o0 `# @& D# j  u; k////下面不需改变////////////
& v" _7 K6 E- _1 X% L2 p9 P. j7 l% t5 D
var copyspeed=marqueespeed
4 S1 ?0 l! D9 F$ U; u# xvar pausespeed=(pauseit==0)? copyspeed: 0) @7 e  y% n* \$ F
var iedom=document.all||document.getElementById( M! L* K/ C6 @3 A" S. ]8 A
if (iedom)% U0 p; W3 i; i
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')3 F  d* `, P7 ?2 T2 G% ^' Q, S
var actualwidth=''# |8 W0 L+ g* |5 m1 k- H# Z
var cross_marquee, ns_marquee* L( V0 ], c& ]; {! @" i, C! K: q
  I0 D& ?4 |" `+ q# ]% m
function populate(){: W& ^& \: J7 Z5 H5 J, I$ B" h
if (iedom){
1 r6 o" N- v; m" W+ B2 ^cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee0 a2 j: `: Q, ?7 f7 C# A* B$ ~
cross_marquee.style.left=marqueewidth+8
# O0 f& S/ v7 s% H* Z* N( rcross_marquee.innerHTML=marqueecontent: D3 P" d; d) \3 Y
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
3 h8 ]' Q# N7 R- V" g9 _}
* j/ d$ F: h" r! f- t% y0 ]  E! W5 selse if (document.layers){
! h9 o$ `/ c- w$ m' n( \ns_marquee=document.ns_marquee.document.ns_marquee2
) ^, d3 j; a) \4 ans_marquee.left=marqueewidth+8
. w8 K. M& J, Q$ f& S" Lns_marquee.document.write(marqueecontent)/ R# t. p) M6 ?* s' p
ns_marquee.document.close()5 ]0 a& u3 Q% T7 s3 [6 U& l
actualwidth=ns_marquee.document.width' d4 J7 J2 S0 q+ k: A! k
}
3 O% t6 E; y$ D3 H; O' Elefttime=setInterval("scrollmarquee()",20)
4 U3 H8 p, C- O2 K. f1 j9 K}; }' b: s( H- v3 B9 B+ g
window.onload=populate
: M. w6 g  U) ~. u% L6 ^# i, f- X; d" L9 H
function scrollmarquee(){8 y$ D1 h2 z3 P# [4 |
if (iedom){; N! G' a4 @2 e: O
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))+ H% M# E3 R9 q6 r8 g
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
% }# B+ c7 z$ s/ ~% {4 x  o$ ~# _+ r# Pelse
4 U( j9 Q* h) w: M) I% |, Icross_marquee.style.left=marqueewidth+8
3 f8 Y% }6 @' L5 b* D4 b, Y( Y
5 S; {& W0 M+ z}
7 B! C4 [* _& t% b* R  P, Helse if (document.layers){
7 ]5 {9 E( x9 c( Y3 z( Dif (ns_marquee.left>(actualwidth*(-1)+8))
  _" N9 r+ T" H+ L5 X3 fns_marquee.left-=copyspeed
8 N  B5 o* e8 {% S5 delse
1 H* x! V8 L0 [0 P1 tns_marquee.left=marqueewidth+8* i. }* ?9 j$ ?/ @$ A1 m1 g
}( H9 U" w) b: {$ \# p) S
}1 L9 n3 P9 z. r8 U1 J1 Y9 b' F
& d) x. w# U* Q9 u
if (iedom||document.layers){
6 V8 |( F1 g) B; G! owith (document){: P. U( R# U5 D
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')+ n& `- q+ ]( A0 u$ y
if (iedom){
" m$ j2 ^6 B# |+ o+ twrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')- K. M* p  O0 u- D- m: I
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'). Y6 R0 {2 n) D' l  |, K( }
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')3 x  D! f' c; C! O/ m9 L& M1 @* f
write('</div>'): O( `/ l9 b1 j' r- M9 Z
}
% n0 S/ q7 N1 @0 eelse if (document.layers){
  R5 [' v9 ^. `4 `write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
3 F/ d  [% ^! B" i- D0 g) Bwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')1 a( K3 C) a' H- B# }6 K
write('</ilayer>')# O4 K+ r& O/ L; p8 G
}
6 C+ E, i. U% }6 }4 ~/ Ndocument.write('</td></table>')& C  b6 t9 `, g6 _, H
}
5 `4 n6 W% N6 Y) ?2 [' E}' ?8 I/ l( d% q2 B1 _1 u
</script>

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