返回列表 发帖

网页之跑马灯文字特效

//修改宽度) D8 Y0 N0 k4 H' v. e% g& u
var marqueewidth=300: C  D  H# J5 D; r0 v
//高度  o: d! s4 m: X6 D0 {
var marqueeheight=25  u# M3 ?+ e$ T% r
//速度(1-10)
- Z& Q: l/ g1 q1 n( Z: y* l( Xvar marqueespeed=3
: a1 z! N6 |% M$ s; i5 c//背景颜色
( J- v; l' N4 [  G* A2 lvar marqueebgcolor="#FFFFFF"6 \0 [$ s9 f& M  n- J  U1 q& `  C
//是否能暂停 (0=no. 1=yes)?
" p! G6 u1 E( r1 s* cvar pauseit=1
* h" m0 y$ O2 _: Q4 c: X
  Q' R! d* B" v- z0 x" N6 D//修改显示内容
: s; D; F- \& ~! i9 l7 bvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
% d: l0 q/ H0 i1 @) n2 U2 H/ H& v

; I" ~. x7 I  X9 G& X////下面不需改变////////////- V$ [9 y5 ]$ A+ ^, e/ ~

! p/ e7 }9 [# xvar copyspeed=marqueespeed# h+ g1 N# G3 j
var pausespeed=(pauseit==0)? copyspeed: 0/ o0 \& J- o: T
var iedom=document.all||document.getElementById  V6 @% U- X; o, ^9 I" X
if (iedom)
# C$ @9 c# @0 ?( z  zdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')& a; _9 A2 d' g' f0 ^5 T, x
var actualwidth=''
) U2 P% @/ C4 h( ^" [var cross_marquee, ns_marquee
* [( F6 ^9 n! X3 S. s4 y+ m' ]7 T# O& |9 A" j
function populate(){, s1 \: ^& W0 Q* B
if (iedom){" c' O2 n2 k) C1 {2 B
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee4 y7 @! w7 ^- s% O9 t; j( R. f/ X
cross_marquee.style.left=marqueewidth+8( }. Y0 Y+ S) t' E: l, M
cross_marquee.innerHTML=marqueecontent
- D5 _1 v& S7 Z9 W% ^' s7 zactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
7 K, \' w8 U4 ~/ ^' f7 M+ X}
" s5 G% Z1 D6 P! r! Y* I# Y: N5 oelse if (document.layers){, E/ g" t6 t- p" I
ns_marquee=document.ns_marquee.document.ns_marquee29 z8 q: }* g1 }9 z% R
ns_marquee.left=marqueewidth+8; q) C- n; h0 n
ns_marquee.document.write(marqueecontent)4 g7 U8 J( p0 A9 K/ H1 \3 D
ns_marquee.document.close()+ q) J% _- S0 D5 v. p4 t
actualwidth=ns_marquee.document.width) T9 J: e6 {" }4 f# f
}/ l1 }2 y  k9 K/ S5 V6 i% U
lefttime=setInterval("scrollmarquee()",20)3 h+ ^- J5 u1 R, O
}
0 }/ k3 ^) p; O+ K2 q# Lwindow.onload=populate
  a# m* I2 r& h5 P! G$ J4 @' a
: }, D! K, O8 ~+ o0 F( {3 ufunction scrollmarquee(){  o2 f( e1 w. \! O1 o  _# G3 @# Q8 l
if (iedom){
6 y" u' C1 ~# N2 A9 B3 Hif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
; w8 ?, H! Z* b2 c: D& i! m  R4 g( Rcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed; V! T1 p" p7 v$ E/ M4 X  q7 B
else
( T. h# H0 w& g- A" H) s5 Ccross_marquee.style.left=marqueewidth+8
5 @' ~2 h6 {, _4 L9 E0 N7 \: P5 U5 |1 b# i9 r( L
}
% e. ?6 ^3 p% }+ d3 Felse if (document.layers){
: s: I8 e6 @! H8 Aif (ns_marquee.left>(actualwidth*(-1)+8))
) X: s+ h  h& u1 Z! G9 I; bns_marquee.left-=copyspeed
  r, \8 A' o! o2 n: |* selse
) E! U( ~8 P$ X$ ~! V3 Rns_marquee.left=marqueewidth+8
3 O+ W" X, C: f4 A2 H}
, T2 r2 t; e9 _}: i/ e; M- p9 z2 W% t

) N! D- B5 n) o0 Q7 Nif (iedom||document.layers){
( g& H8 ^) G% |6 D# i0 D7 \7 Nwith (document){
# @: g5 Z; v/ e1 h1 s, pdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
5 [: i/ y3 ?" i% R$ O$ Vif (iedom){( B7 u( W. t& `) X. e
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')  _: a; z( u. T. w! G# P
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
( n2 \2 S, W$ c* T% Qwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
3 c3 v8 K0 b2 }) v# vwrite('</div>')# Y) X" z' V0 I. Q
}
0 Y! q* @( w, U0 ~. |else if (document.layers){* y5 }' q5 X( h. C0 B
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')8 i/ g1 x+ g& T* u+ m
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')+ C( G8 K& l9 K7 E* }- @
write('</ilayer>')
; K, ~! E& F/ o2 J7 w$ r}8 t# h& A1 x) ^$ `
document.write('</td></table>')
% `1 O0 T% U/ C# x. z3 {}
8 U9 ~1 E) F, P3 ^}1 R7 Z- H! t& c# M# P
</script>

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