返回列表 发帖

网页之跑马灯文字特效

//修改宽度
2 Q, @3 w& B9 Y( F" E# l! a( i) f, Cvar marqueewidth=3003 [+ I( @$ e2 G) G
//高度  |4 u9 @, Y3 }+ D# s7 P6 S& F1 s
var marqueeheight=25
8 y2 G3 U. H9 O5 t1 |. U//速度(1-10)
! [! n! t; \0 q3 [3 S1 evar marqueespeed=3
# A/ V) t7 c" E! s) H7 C* J& s//背景颜色* G; v1 N2 P9 F5 o, G; b
var marqueebgcolor="#FFFFFF"7 M4 T. W: H7 x1 e+ ~) X9 h- m
//是否能暂停 (0=no. 1=yes)?
8 N: o) r' S* d' g; K0 qvar pauseit=1: C9 t" k) z% L2 [/ U+ c/ X8 y& u

) |, P4 M& J; ]# n8 I8 Y& Z- y//修改显示内容9 W1 _$ l- w& w& u( z3 t
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
: q: f! N4 ~2 J8 |$ @5 [; W/ ~+ _  h; D: T# l( r# S

4 j5 S9 r1 ~# f6 p8 t2 s////下面不需改变////////////
) c! f$ k) z, f/ j3 }) I1 ^# T) Y  V* E/ L
var copyspeed=marqueespeed9 d# a8 y! F3 G
var pausespeed=(pauseit==0)? copyspeed: 0
5 H9 N/ \1 _* |( ?) |9 nvar iedom=document.all||document.getElementById
. V4 Q- r0 {! |if (iedom)8 p( u% _$ Q9 p
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
& C) W3 _8 N  w9 s9 \+ fvar actualwidth=''
! @( C1 V9 e, F( Gvar cross_marquee, ns_marquee
0 Y; m! |% V8 ?3 Q. ]
' x. C/ E7 J" n9 v; N1 t' Y( v1 Efunction populate(){
6 u+ H) U; H5 J# }& a7 ?# Dif (iedom){
0 i9 E3 c/ N) Bcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
4 T' p) s  B$ q1 Icross_marquee.style.left=marqueewidth+8
6 q$ j* [) R! B0 i- u* ^cross_marquee.innerHTML=marqueecontent
% v5 \/ e0 M: s- oactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
; i( |: \4 v( J/ L9 o! D, }}
! d$ _* f1 K  i, R1 |! i& Eelse if (document.layers){! X" a9 D0 j" `3 ]3 b
ns_marquee=document.ns_marquee.document.ns_marquee28 U5 X& D$ P# w" d% v9 M% s
ns_marquee.left=marqueewidth+8, P" o) i; {8 }  r
ns_marquee.document.write(marqueecontent)6 X. \6 E' [4 Y9 K( l8 t3 R
ns_marquee.document.close()' x8 i6 B; R( X/ Z- S+ P  W
actualwidth=ns_marquee.document.width& x3 R. d& z1 M1 Q8 g
}
5 h! B7 Z$ a/ _; U- A1 j" Xlefttime=setInterval("scrollmarquee()",20)) p' b: t# f% Z
}& R9 T) ]% Y2 u! _
window.onload=populate- J- v9 g! K8 l* _
4 t0 B8 t3 A* t$ M/ ^/ z8 @( F
function scrollmarquee(){
6 \/ L( l" t; b/ [if (iedom){
/ r. V. G! T" D5 bif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))) F" T8 V( ?, P% M
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed) |3 Y2 F4 C' Z  C: l+ e/ X
else. e+ O5 O& b# i: p$ u
cross_marquee.style.left=marqueewidth+8( p0 }7 x3 _% \6 D' J

# p( N# _, Z" s  k% A2 r: l}$ ]5 k1 {6 `% H* W/ H1 n8 m
else if (document.layers){
# w% H$ V6 Q" V! o0 Wif (ns_marquee.left>(actualwidth*(-1)+8))
" |6 T# N6 f: s( gns_marquee.left-=copyspeed
5 b( |) M, P/ o; h* u( aelse
+ ?7 K  m. r" t* i  s+ ^  ans_marquee.left=marqueewidth+88 i* B, q3 q- D5 y3 Y3 d- i
}( z5 Z' J: W2 }( h) v/ i' T( _
}
4 @: `$ g6 ^9 @+ ]; i- C
9 B' {5 g8 o) @6 ]; @* Oif (iedom||document.layers){
. l# e2 \2 ?$ E; l6 Z# C3 hwith (document){" N+ u! N! b3 J# X
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
  j2 V1 G; c4 b; g4 f1 ?" g+ k3 Hif (iedom){
$ [: m. `  u+ `% x) u- }' Cwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
8 A: g+ ^4 F% S" v" i1 g7 S  ]# lwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
* z$ _" J7 m' N; I0 C1 lwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
$ E9 |" a) S: R6 [; e" M- awrite('</div>')
% y! P6 }3 D/ C* P' e! q9 `}
5 b& \& e) X3 j4 h5 K0 felse if (document.layers){1 c9 g, x" h* @2 I0 r/ z
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
3 [6 @* B- s: w) U* ]write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
! K/ r6 _% @- c# q2 `! e: uwrite('</ilayer>')3 m2 G6 O, C9 H0 L+ d3 f
}
! d8 i: k& g& idocument.write('</td></table>')' b; B1 g7 \+ c3 B4 G* b
}3 Y6 P- P" W, K! {7 Q1 j6 S, j
}
7 s  z; y  n0 j9 W4 `; e' e</script>

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