返回列表 发帖

网页之跑马灯文字特效

//修改宽度6 A  d' E% V3 F8 y) b
var marqueewidth=300
5 Z+ J9 `/ @) i% }+ M//高度
* S2 W3 I- g# D" x' Bvar marqueeheight=25
; C4 h2 x9 @2 V" [- |3 {. M//速度(1-10), O' ?0 N' k( v7 L4 x
var marqueespeed=3
5 p3 {3 d. n+ C( m0 e//背景颜色4 i2 D% F4 G+ E
var marqueebgcolor="#FFFFFF"
. [1 V2 q  h) G- J//是否能暂停 (0=no. 1=yes)?
: h2 O3 D0 c0 c- s6 Svar pauseit=16 o3 v% z+ G, w" u+ Y

/ c# N8 k: t* h7 R0 c* e//修改显示内容* w$ U. D1 |' X0 \/ [3 ]" q
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'' |0 q" u2 B5 {% M' G, J/ P( u
2 p* x, Y; i2 ~8 M5 T

  k" ^2 B4 ^; O) ^! Z$ i8 i& W8 X  w////下面不需改变////////////9 a: d0 X/ c7 }6 \$ V

  U2 [! G& _, Hvar copyspeed=marqueespeed
/ ^2 O0 P$ {( V$ svar pausespeed=(pauseit==0)? copyspeed: 0$ p- ^1 V. k  _. H/ X& s; m+ h: h
var iedom=document.all||document.getElementById) z+ e% ?0 m4 ^* j
if (iedom)) i! c3 h- r2 W  J$ G# W, o
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
% X0 D- [1 t* |, [  x4 Ivar actualwidth=''
3 C' R8 T5 o2 X% F4 [& Tvar cross_marquee, ns_marquee
8 ?) X/ O5 A! K: A4 c+ w8 Z1 V4 ^1 T8 x0 _3 r+ S; n
function populate(){' L+ z' X5 t- m. L# A& a2 j
if (iedom){- S7 G3 r) G8 Y& w# g
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee! N: h3 ^9 G, e. a
cross_marquee.style.left=marqueewidth+8
  D9 K) V0 g/ t7 Across_marquee.innerHTML=marqueecontent. B! m& p. T6 `# u
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
( t, \8 \, d+ o" K! h1 d/ ~, N}
% _; A, s) r- K4 Felse if (document.layers){$ v8 b4 T( E* A7 n- g3 _
ns_marquee=document.ns_marquee.document.ns_marquee23 k& D/ ~- t0 [
ns_marquee.left=marqueewidth+8
+ L/ q0 N) S  R9 i$ l& o% R9 Ons_marquee.document.write(marqueecontent)
1 a# M3 D! S  h' N! kns_marquee.document.close()4 I8 s7 m& m) A% f, v, f
actualwidth=ns_marquee.document.width
) w" y3 Y6 S, c9 Y$ R$ L}
7 A' M# {. S" Z/ y4 k1 r$ Y) slefttime=setInterval("scrollmarquee()",20)
9 D0 W8 e+ [' V4 J, H5 y. U# N}
! ?( ?  t. R) L9 Vwindow.onload=populate
/ |( S2 s, N9 p: B% O2 J# b
# E7 [8 F" X6 y- O+ Q8 _function scrollmarquee(){
0 a, P8 u: M. X! {  n; ]0 \if (iedom){: j7 B7 N1 Q, L) j4 N, L$ @, n4 t: @
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))7 \" n% Y% }' D1 P; _3 X
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed; k- R" Y+ g: J4 S2 a0 S# d# e& v
else
$ ]; R& m/ x" Y5 W5 Dcross_marquee.style.left=marqueewidth+8
0 m% h6 V' o. f4 ^8 B+ [6 ]* s- q, i# X. J) o& F! m
}
& N: k; |5 N( ~/ belse if (document.layers){, [# W5 R5 U; u& R
if (ns_marquee.left>(actualwidth*(-1)+8))1 ]$ Q+ R6 k' v8 G! x4 }1 k
ns_marquee.left-=copyspeed
, V9 E1 m! J- q2 M  n" }# w8 uelse
3 n: j) y3 p- V1 jns_marquee.left=marqueewidth+80 B, \: h. ]# }& S0 o
}
$ v$ z5 Z0 D+ M2 w. C7 x6 ?}. q/ f" N7 w5 a' [$ K

/ L. d0 l# \7 h% ^& Mif (iedom||document.layers){
$ o6 E( K8 d: ]8 a. ^) ewith (document){
/ C) }% O4 {9 X9 b  N$ {7 g5 {: _document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
. k2 F% B1 X! W( {9 }* p/ @if (iedom){
% j$ Z  n7 R4 u5 K3 r: n5 Zwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')  O; [! c( {: Y* Y7 E; I
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'): u+ r. Q1 D) X* a) y
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
4 x+ @, c/ ^7 E4 F" v2 @: Pwrite('</div>'). K* h4 \) |: ~3 p
}9 v0 ~5 `9 j  G9 \- @7 k& ~  P
else if (document.layers){4 J2 n0 N5 ^8 Q1 W% D
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'); s6 G3 R5 r8 u* I
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')' W: M! u0 T! w% T' K
write('</ilayer>')
' k$ b+ u9 z; i0 i4 g& _}+ {; Q  n; L3 v- k- ?# p
document.write('</td></table>')
. k( L$ i4 Z+ w( \3 j/ X}6 s* a1 w+ A; i, g4 h3 X
}
8 ?$ k, v, ^; q4 H1 o* g/ T; ]: G</script>

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