返回列表 发帖

网页之跑马灯文字特效

//修改宽度6 A8 U& k9 r& `# ]: \
var marqueewidth=300: N4 {1 m* u  \9 L) x
//高度- Q4 c9 m3 ]: I! k
var marqueeheight=25
) Q6 U7 e( Y( K//速度(1-10)8 z% }4 w+ o* n4 D# g
var marqueespeed=3# i" T' G) o3 Q, H$ }
//背景颜色3 y8 i$ V- {% \& K
var marqueebgcolor="#FFFFFF"
$ D& h2 e% E( |+ s$ E& r//是否能暂停 (0=no. 1=yes)?
" V# O. q* Z, O, z. [4 L) p$ _1 Fvar pauseit=1
- a' m) L; j3 F: \* z4 C! P: Q5 W- H# s* t. h+ F. p8 C( l" m- n" s
//修改显示内容% W  t* {2 ^/ g4 D
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'/ Q! R$ Y" J' @3 D% h8 j

! Y- @( ^- l' V( g3 b
7 H) ~+ ]& p1 {2 Z. v% X; L0 s# Q////下面不需改变////////////4 W  c3 E' A) ~7 @7 H! n
$ w$ m7 t& _# w6 e4 L6 ~$ \
var copyspeed=marqueespeed  N4 _! D3 D% N3 v8 c! |
var pausespeed=(pauseit==0)? copyspeed: 0- ]" g. I1 ^. J
var iedom=document.all||document.getElementById
7 @$ k; E) D$ c/ a+ m$ _if (iedom)7 J2 D) ?/ a% w0 V( V" i/ U! }
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')! U" S3 \0 i( c- }+ N8 k, K/ `+ Y* {
var actualwidth=''
9 u# N: h6 A4 L/ q5 B, @; hvar cross_marquee, ns_marquee# h' P3 F8 ]# z% @

, A! U! S  p# O2 [' [1 E3 `function populate(){
! d8 ^1 p$ v* X$ @1 Kif (iedom){0 c1 v2 P2 o6 [8 k8 j
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
( n3 ^1 g/ G/ y. qcross_marquee.style.left=marqueewidth+8
  r7 Z. s$ O+ s8 T" K9 gcross_marquee.innerHTML=marqueecontent" h. A% y* n( n$ N. B8 ]2 Q* y! e
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
. t8 n8 |8 N& S: @7 s6 o- f7 Q}7 d6 l2 V) B4 m& l7 g# x$ c+ _2 f5 c" U
else if (document.layers){
6 ~8 N3 N0 \# k3 a  w( W- xns_marquee=document.ns_marquee.document.ns_marquee26 O' p, O8 j/ X+ v. \: k9 x
ns_marquee.left=marqueewidth+8
( Y$ a3 m1 g* b2 p  h8 C$ I1 Bns_marquee.document.write(marqueecontent)
* g8 V" a% j& ~( D. @! e' w; Gns_marquee.document.close()
; p  x7 P! K5 Vactualwidth=ns_marquee.document.width
; m2 y. H$ b8 o5 u5 H; _# Z}
( e  J( g5 Z' J3 Qlefttime=setInterval("scrollmarquee()",20)
' R+ M/ Q# I9 j- g3 ~$ B) T}/ x/ _7 w. N/ O9 ]4 u
window.onload=populate
5 H9 P6 |$ C% E1 F! a$ z3 v1 T+ n6 m5 |: ?
function scrollmarquee(){, P+ x) K1 E- K, y
if (iedom){
% V" P' u: Y1 I$ _$ b- Jif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
. I7 `" q7 }. i* r7 E. Ycross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed6 Z: C0 Z) L/ j
else
) [! w9 Q0 Y( [8 R! _5 t/ h( j  pcross_marquee.style.left=marqueewidth+8
- u1 \# I% s) h7 i$ f) O! U: E0 Q  q5 E. G, W  {. D$ F  [
}$ f& L/ Z& [; Z
else if (document.layers){( l- u( T2 q$ T
if (ns_marquee.left>(actualwidth*(-1)+8))
" u9 {* e1 S  q1 m% Ins_marquee.left-=copyspeed+ v7 S3 F- `$ Q% C& C4 e6 L1 u
else
1 n* c( G' Q. }9 o% ?( C3 A/ i. h1 Bns_marquee.left=marqueewidth+8
* b" E- L2 S0 c8 f}& q* A1 ^. L- O0 G% k: ?& a) {" {
}
: R9 w) f' q+ @  x3 ~6 z
! b5 X. V% n: @) p2 c  Y$ iif (iedom||document.layers){! o+ {! E/ R9 x& O2 _
with (document){* X: i& a' B& q; I2 j$ y
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
: V; v  a; a% S7 E  H. z4 zif (iedom){
; c/ }3 B1 }9 o7 j* \  ywrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
2 @, ~! ?5 S( B* l; Xwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')6 w7 v) f2 C! N( Y  ^
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')4 q& E2 L' P3 Q' |% D$ f, _/ X; G$ j
write('</div>')) f7 Y2 v" K2 z, `
}& Z; @, M6 E6 D; s8 t: o
else if (document.layers){
! x' F2 b" C! Lwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')& X5 O* m2 B  f: T! C, `( s
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')2 W4 l1 J" f- ?: N+ ]
write('</ilayer>')  G2 `4 v( n) C! W, |$ ]/ p
}. |  j# H$ [0 `7 r8 m, l
document.write('</td></table>')  w8 x. I4 k% Y+ \2 D
}% b) V* A- _- B0 L6 _
}; @5 y! V8 A8 ^. `9 V& ^& ]; P
</script>

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