返回列表 发帖

网页之跑马灯文字特效

//修改宽度" S" {+ i. O* z' t7 G6 j
var marqueewidth=3004 m, n' K- y( p& {( T
//高度
9 {& i  C3 V0 ivar marqueeheight=25
( O" _' s) O7 d/ |# [* W//速度(1-10)
$ h* `+ W& a$ g; O0 h2 N: Jvar marqueespeed=3
" h+ t' l. t7 u6 N/ J/ Y//背景颜色
& v. Y# }3 w# X- uvar marqueebgcolor="#FFFFFF"3 f8 l; a( P4 s! {: N7 f- N
//是否能暂停 (0=no. 1=yes)?
) b: G1 T( @: o$ B6 }4 k+ E: Dvar pauseit=1
2 }0 A3 D. G! @$ O1 d3 b  o- O
5 j5 I8 m7 g. _- g  ?9 V//修改显示内容
* X5 _0 m* j$ ?( g; Z9 Wvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>': s, w0 z6 Q( Q+ x9 N& {
$ n# g( |, @7 C; O" b5 p

2 }1 l+ o, g$ J+ R////下面不需改变////////////2 _, _& u+ F. O- V' ]# u1 u

* _$ _8 ~% k1 j0 Jvar copyspeed=marqueespeed+ f- R, S. \+ d* ]0 V: Z0 [
var pausespeed=(pauseit==0)? copyspeed: 09 f8 Z9 b, Z2 l; P9 x& p- j2 ]
var iedom=document.all||document.getElementById
$ i  V; R  N9 v0 ~; o; Cif (iedom)
$ Y5 C- p6 @/ o' a& I+ p0 b  jdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
- L; ]/ S# ^' Gvar actualwidth='': i" O5 o$ u' x: ^( ^* C
var cross_marquee, ns_marquee
* c9 H2 r# O4 m7 i3 F6 S) r0 R# L
. ~/ ?/ w$ Q+ a8 Sfunction populate(){) H( `; R' y4 n- B
if (iedom){
# ^4 m% ]& A) u/ n* i' ]4 xcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee, }$ H3 \+ `8 {5 |; }$ h0 C
cross_marquee.style.left=marqueewidth+8
+ l3 N- o' G; I1 I/ X% b' Tcross_marquee.innerHTML=marqueecontent
2 Y' z, [7 ]: ?' K, ~6 Q3 factualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth1 h$ |7 @, R- X8 w1 y
}
5 o3 Y# V3 B  X  n+ t: E+ Welse if (document.layers){
* x% F0 q' }$ W7 C- ]1 A% _) Z0 ?3 ]2 cns_marquee=document.ns_marquee.document.ns_marquee2' |2 `/ D8 s9 J* o% U7 X
ns_marquee.left=marqueewidth+8
: z. \- i: S7 l0 i* A6 [2 Xns_marquee.document.write(marqueecontent)
) f# w+ L  Y6 E+ f' }ns_marquee.document.close()
+ l* f" z- _: a# b/ A2 Mactualwidth=ns_marquee.document.width( K: {* z1 V" l% Y0 B" ~4 r
}
# B9 J$ }/ G+ [7 J/ }9 H5 Y' Alefttime=setInterval("scrollmarquee()",20)
4 L1 f- ^9 P0 {  j}
6 t1 }5 _8 A$ H3 B* r/ n$ ^$ bwindow.onload=populate6 y/ `$ r3 r( k/ o6 s) V  b8 x, n

5 r- ~4 M& u2 W/ A! Qfunction scrollmarquee(){
! k2 _. i1 _4 qif (iedom){" u3 S! H& S+ ?1 Z
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
: m  V9 [+ t0 G# }cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
  m5 ?0 P8 O5 M# e( L5 t$ felse7 i: b( n6 B( m+ y5 ]. q
cross_marquee.style.left=marqueewidth+8
- C4 n' M' }! ?1 s$ u2 _
' m. c, x$ h. W3 H- u5 O" E}
6 y/ H( s* |2 E, telse if (document.layers){
. S: j& O. ]  R2 v: ^3 s% q7 ]if (ns_marquee.left>(actualwidth*(-1)+8))0 g7 k- u1 F6 m' e+ Q5 {
ns_marquee.left-=copyspeed
. ?' z& |# f" j+ L9 p6 Eelse
7 k1 w5 [! I2 U+ {/ Ans_marquee.left=marqueewidth+83 @- `* x& ]. W, E# I) z8 j
}) n4 s& x% |( T% D/ l1 q# G
}
- z/ u; A4 V% M5 U5 y. q& @2 K# a" L; R% h
if (iedom||document.layers){3 v# P; |$ i0 n% J/ a
with (document){- E: y3 B. A  I7 j* H- O0 v4 P
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
' J, X' X2 D: \7 h, ?" nif (iedom){0 H' T. N- ^, D5 r/ R, Y' {) o
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
. l3 ]6 n; H( i+ ?) ywrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
" S% y, H$ Y( d$ Xwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')) @: W; C/ e, ^% \/ s/ M, d! V
write('</div>')
6 g2 L9 F/ B& z% Z; n}- V" Q8 B: \; l+ N6 ?
else if (document.layers){7 R" f6 t. }6 |2 X! H9 F
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
4 ^9 J$ O  ?, [write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
; k  }+ [. V/ Z# Zwrite('</ilayer>')
, s0 s+ q& Q" i% b; E: W3 u, i}& e& L' v+ }" W. P2 R# M
document.write('</td></table>')- d: S% x5 Y4 Y7 f: p8 H
}
& A" @. |& a4 x' N  p}& ^5 R7 E4 O' O( g8 k0 O! x. ]8 c0 T
</script>

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