返回列表 发帖

网页之跑马灯文字特效

//修改宽度; j' M$ [$ l1 Q8 Z2 T% R
var marqueewidth=3005 {7 L! D# C  f- V" @3 G( T
//高度
3 e/ Q; j2 P2 I* z) B( F3 Rvar marqueeheight=25
* _# ~- X- W! h! {//速度(1-10)
+ p& Z; F3 K( a4 svar marqueespeed=3  s% }1 C# s" w1 k3 N
//背景颜色: C# a, d4 e  ~  m1 Z/ e
var marqueebgcolor="#FFFFFF"
/ a! E; ^- v4 B, w- z//是否能暂停 (0=no. 1=yes)?
" O: o* N. o  V  i3 ivar pauseit=1' e$ p1 Y) B3 x

7 ?9 I( p% s6 W& v! W//修改显示内容
# A0 G  y! M8 mvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
( k; N9 W5 w) g4 ~& B: a2 E. \/ b3 K2 }8 ]  W& S
+ B6 @4 S# w0 O6 w6 q! f
////下面不需改变////////////
5 d& S; e7 g; q# V7 J' a) g) |# M7 t# t3 r* a
var copyspeed=marqueespeed3 b: @7 w8 u3 K/ [$ [" ^9 O. F
var pausespeed=(pauseit==0)? copyspeed: 0
" H5 U* t# C9 h7 C2 O; L4 Ivar iedom=document.all||document.getElementById, r) T( v. |) I/ \' ]2 Y
if (iedom)
  H/ p7 ~, h/ adocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')- l! f. d' c5 X. {! M# D
var actualwidth=''
  F" o2 l6 v( A. g+ I; uvar cross_marquee, ns_marquee. M" z1 W9 Z- T: ~6 ]
6 ^6 C3 d+ R( z
function populate(){
& l8 D$ X  y* i  M+ n& A6 Tif (iedom){
; b. D9 F. |/ R7 o' Tcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee; j( v5 F/ N7 m5 q- V% _
cross_marquee.style.left=marqueewidth+8# g7 R0 G7 j! e) u1 X
cross_marquee.innerHTML=marqueecontent/ _/ Z3 B) t. w
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth# ^8 R/ M9 `' c, p% Q
}' t' F1 z' j: T7 m5 L
else if (document.layers){
* t# Q7 A5 C/ q$ Xns_marquee=document.ns_marquee.document.ns_marquee2" V/ Y; v4 C5 J* Z- {& M1 E
ns_marquee.left=marqueewidth+8
; W7 v1 y  t; b; Dns_marquee.document.write(marqueecontent)2 j9 Q$ Y! L% ~$ p& l( F( R4 e
ns_marquee.document.close()
. d1 ?4 D; J* U# i$ \8 w- mactualwidth=ns_marquee.document.width
$ X6 E8 J( ?( R* y}( Q7 n5 u( c  c' p
lefttime=setInterval("scrollmarquee()",20)
, s' _% }, F/ m6 m% e  v}
: Q8 w* K7 F% C+ zwindow.onload=populate# R: q, p# T# O( j

2 n- x5 T) `( O8 d8 d  Xfunction scrollmarquee(){1 D  p2 ^- C0 b* l7 |- s+ n
if (iedom){
+ D0 K3 G1 i/ M5 b, G3 Bif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
5 q  I' ~) }: y* ocross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed6 a( x; K8 m2 x4 c
else2 M+ M! N7 H' A* F* x
cross_marquee.style.left=marqueewidth+85 d4 p' J, a9 Q, I' X% F) y& Z* |+ u

" ]4 N' _  _) B; D' e}
. p( O7 A! B( p& }else if (document.layers){5 g/ H1 c; e; s( [) l) @
if (ns_marquee.left>(actualwidth*(-1)+8))
# n: l& F# R& {6 }& gns_marquee.left-=copyspeed
/ J4 ^; J/ {# K% V1 Aelse; [+ ^3 Y# B4 ^, p
ns_marquee.left=marqueewidth+8
  D1 S7 v3 _" r) d' V. e}
! u7 Z7 v3 D3 ~. V}
4 z# j3 G5 b9 g* ^
- E# N9 t- d$ J# J2 iif (iedom||document.layers){! C) P- I9 L' X6 {
with (document){9 E$ m; S" o9 i1 {% {! U
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
5 O: C, r7 ^+ u7 z. iif (iedom){: q0 u/ e* l9 |  X  t. X1 m+ H8 I2 q
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')8 ?" @4 D$ F+ X4 f/ x& V% N
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
, `/ m) J9 b& L6 p* X: L  N% Twrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')- N; Y0 c* R# w$ {5 ~) [% r
write('</div>')) Y' x  w1 r+ z; _- J
}
; o; L4 o2 Q  ielse if (document.layers){3 O! O7 m7 ~; P- C3 g! t& S6 A! B
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
- B. x; S( e2 d5 ?8 d" _3 F9 w2 ewrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')0 g5 |# n7 a- Y& {
write('</ilayer>')
2 b6 W! Z6 [4 l* m}
6 }# G/ q( V! q" v. C$ hdocument.write('</td></table>')
% p( `! R! N8 Q/ q- l; f}
+ R0 I# F) _2 w8 x* x}. C; J3 a1 H8 m% {: \+ `5 L
</script>

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