返回列表 发帖

网页之跑马灯文字特效

//修改宽度
3 W- P; [/ Z' A9 Y: t6 Ovar marqueewidth=300
5 U; ?; I2 g% `$ i* ~. `7 R7 H. o6 H//高度7 ^- ^3 y2 A! J
var marqueeheight=25$ M, `" V6 l/ ]& {0 n* [
//速度(1-10)9 X- Y, _% C5 J) T" C  A- Y$ O/ e
var marqueespeed=3
" }& @: H" D/ [1 q  n( h//背景颜色( E- g! ~9 t% K3 z6 o
var marqueebgcolor="#FFFFFF": {7 W3 F6 @; {2 ?! R% d" B) U
//是否能暂停 (0=no. 1=yes)?
+ G! ]* R/ A( |) ^, [var pauseit=1
5 [* H, G1 X$ Q: f6 Z# ~; G  X- Y# T) S
//修改显示内容
  g6 Q/ R4 [  z; J7 A, g5 z+ @/ dvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'+ w% X$ j- t- e; x& j
  b) U. g1 v" G+ F! A8 ~$ e) B

6 u* V+ E: D& m* }////下面不需改变////////////
0 v) ^" T( a* A( w& e4 ^9 S8 K1 \9 Q, e# f
var copyspeed=marqueespeed4 D- E+ v; Y/ T; v5 u! n
var pausespeed=(pauseit==0)? copyspeed: 0
3 H. I1 L' ^! H4 {1 S; Q! ]var iedom=document.all||document.getElementById  ^: [- I7 Z" s
if (iedom)1 |- P  t" G2 {& E
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
, y- x: p$ j& u+ Zvar actualwidth=''8 b- ~0 I, {6 V6 O  W& F/ h) C
var cross_marquee, ns_marquee# i. p, X. X+ f0 Z# [7 P

# V+ g, n5 ?- Yfunction populate(){
- w! }- X. O" Y/ T# bif (iedom){$ u3 v4 N9 B$ `- `9 T( ?
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee" k  g$ d: E8 p: o5 _0 d3 M
cross_marquee.style.left=marqueewidth+8
! }' \8 E/ ]: |9 B0 across_marquee.innerHTML=marqueecontent
) Q8 o: G0 b# W* n6 {( |7 jactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth( f$ i- d% W$ r5 U+ L, f  Z2 `; y# U$ C
}
* V  s0 _* W( y3 g4 telse if (document.layers){2 Q. P4 d8 [8 S1 F) M) c( z
ns_marquee=document.ns_marquee.document.ns_marquee2
9 r' V( X0 |0 Vns_marquee.left=marqueewidth+82 j: T. ^1 X. l$ k; A0 t
ns_marquee.document.write(marqueecontent)
* {( Y  O5 n! Z6 Xns_marquee.document.close()$ ?2 y/ v" ^. m3 @9 ?( U3 M
actualwidth=ns_marquee.document.width! B: v6 j# n6 O1 k- i0 i
}& f& e/ X: L# _4 ]5 \2 n- F9 J
lefttime=setInterval("scrollmarquee()",20)2 Y* T) }) K  _
}
+ S( n/ z4 ?, Twindow.onload=populate9 O. k4 D0 @; z( p; m2 p- S3 U
& v& W8 p1 o, H# J
function scrollmarquee(){: p+ n; ?9 e# F. S! O1 w2 D2 e
if (iedom){9 k. c# H5 h0 y
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
* U+ G' K# C  r/ dcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
  b$ s) l. O' A) _% U4 xelse0 l1 i* ?' g4 `- i
cross_marquee.style.left=marqueewidth+8
8 i$ b  S! r/ g
- w9 X3 [# X- y0 F$ k}
1 D" A& i/ ~/ N/ melse if (document.layers){
3 l& |7 Q1 b5 z& [* R  c2 mif (ns_marquee.left>(actualwidth*(-1)+8))6 v) a4 q6 B. t: y1 x" k; o
ns_marquee.left-=copyspeed
( q6 W3 d; ?2 h- G  y6 celse
  l$ J& u( z; ]6 _8 V& yns_marquee.left=marqueewidth+8
6 B, c' }$ C9 {+ l! h}4 B  X9 T2 S4 }" y9 A
}, A9 m0 L; G# N* j2 m

, H( F7 z+ i5 t; J$ p' B! mif (iedom||document.layers){
6 d& X) O7 V8 g8 u5 l; V4 twith (document){7 B% ^; T/ n( `, [, y  D
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
0 U  N# i2 D( j& X9 k/ x8 I2 Vif (iedom){4 [1 _  J* ]; c8 [
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')0 p: ~( [* J0 f. k) o# U
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')% N3 u" e/ i" }: f
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
' v' P+ _, t+ L3 w: Ewrite('</div>')
: T3 l! N; j. E' X}6 `& p1 M& ^1 }+ ?0 y6 Q5 ~9 J
else if (document.layers){
7 e  c* G$ _0 U6 D2 W1 ~  Twrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')( I7 i1 p' |& X( b" [# W
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')/ w' t+ o7 X) q# ]! N, C* A- R
write('</ilayer>')2 @2 g) p# b3 q8 y
}$ w% ]. [1 d! w# Y# j5 [. @
document.write('</td></table>'), I$ g" r, r; {3 b: y, I
}' f5 w2 R/ n) R7 t  \8 m
}
* e  W! H3 C6 o</script>

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