返回列表 发帖

网页之跑马灯文字特效

//修改宽度
: V+ k, F# Z% |var marqueewidth=300
! N/ \, u6 @9 ]//高度7 y1 g1 b; J3 E! a+ I
var marqueeheight=25+ ^, e5 I% E- Z( n% r  n% M& {
//速度(1-10)
1 z, T; T' ?6 A, v( `0 Ivar marqueespeed=3
. i4 e4 N3 D- r- G6 {# `//背景颜色
: |0 B  _* |2 b/ L, q+ ovar marqueebgcolor="#FFFFFF"- x0 ]9 [5 N  y
//是否能暂停 (0=no. 1=yes)?$ \4 F% `6 F& F' x
var pauseit=1
: o' z# l8 \+ h# f, a9 G5 S9 W( U) U. J8 k: t
//修改显示内容% V3 F4 T. \+ _' |0 C9 ~0 g
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'% d' c4 ]8 a( W! H: _

* e3 k( D! {( ^  P% D
6 m" m# F9 h2 {& J# b+ h% E7 I////下面不需改变////////////! Z  A( m- `; m% b8 P7 n% H
8 g: P0 D7 O3 X: |8 _+ P. W
var copyspeed=marqueespeed
% M7 `; \5 _7 V5 d- svar pausespeed=(pauseit==0)? copyspeed: 0: o. w) j/ C+ F( S  T. w. l
var iedom=document.all||document.getElementById
  S' S" D( N+ y8 Pif (iedom)
; @* j$ E8 \8 k9 p1 @document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
" m0 F$ w/ P/ W/ C3 ?) a0 ovar actualwidth=''. Q9 Y( m3 [" O9 w9 t" P
var cross_marquee, ns_marquee
3 K- O5 t" X% {
% d( ?# c' f0 v7 {& |function populate(){
3 z. F+ w% K0 ^8 p7 ~  A  aif (iedom){
; M+ i4 I& ?  Q7 _' H2 c8 `cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
) h3 S% {7 X7 U+ F0 V5 fcross_marquee.style.left=marqueewidth+8
) n  Z" ]& h' m! gcross_marquee.innerHTML=marqueecontent2 ]# |$ R& v1 H
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
# L  V0 \8 _9 e) L}, L- M7 \. ?3 ?  Q" U. R) T
else if (document.layers){1 s. ?% H* S$ B3 D3 T0 e
ns_marquee=document.ns_marquee.document.ns_marquee2
: R3 q- |8 o/ T$ m: Ens_marquee.left=marqueewidth+8
; ^$ s- a  y9 xns_marquee.document.write(marqueecontent)4 |3 u3 c, R* ]9 g1 D" l7 H
ns_marquee.document.close()
1 u9 m2 ~0 Q3 x; S, hactualwidth=ns_marquee.document.width
- \) C  T% {% U# l; b" W4 Y$ W+ R5 p0 b}: e5 s  _. Q' N- S2 J" y
lefttime=setInterval("scrollmarquee()",20)# q8 Y+ y8 {! a  S7 o2 ?
}
+ a2 s6 f" l9 u' U9 [/ A$ Y+ `% {window.onload=populate
2 I# w. u4 A' ^2 v" [4 F1 c: ~9 A5 L! m/ s: X4 e9 N8 q
function scrollmarquee(){; X; @3 c! r! a7 t  l" T
if (iedom){$ B3 x% R1 Z' W/ ]- ^6 }6 s. t/ b
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))7 O& g8 l1 r. M8 I) t1 W/ D) T
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
( S! c1 Q0 C* B& R( a+ }else
- R7 r/ T# P1 m% W, jcross_marquee.style.left=marqueewidth+86 g. `: k& `/ }2 g9 x& J
  T& q7 `0 G" v# J2 v
}9 O5 z' Z! V! j5 I9 W
else if (document.layers){6 H4 T; }3 |, a9 r) X# I% `
if (ns_marquee.left>(actualwidth*(-1)+8))
$ F+ K4 s7 t* m, ]+ `ns_marquee.left-=copyspeed
/ V7 p& i5 E- e2 k4 h2 j) Felse
1 [$ N3 L. b4 G; T* T" Ens_marquee.left=marqueewidth+8
; j2 ?% S( d, `% v- C; B}
5 a% j$ C4 {  g; z& V}, D3 U. A6 D: x$ X0 j, y* ]/ O7 X
! z! d' c; E# Y& S8 @: ~! B( ~
if (iedom||document.layers){$ l! r* f$ K6 x
with (document){. [% v% L3 T- J
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')+ G  W7 B+ `# \, e& b( H# v& L# M
if (iedom){$ C' q/ H; C8 C; f6 k! N
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')8 X5 Y9 j& [5 H- u* G( _: u
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'): [5 ^% A5 I4 Q# b
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'). g7 e" v1 y) @( b% c$ f" a
write('</div>')
6 @6 l  F) j: \; K" j# m% g7 E1 R}7 e3 M& K: ~. B& m2 }: t
else if (document.layers){! @) M9 k( Z) E' t( }- f
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
1 k7 A7 K" I) V7 x1 V8 fwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')  Y! r6 z9 E3 f0 h6 ^- _& X
write('</ilayer>'). {( N6 n+ a) u* [4 n
}# ?# n/ o" j" C" D
document.write('</td></table>')9 Z1 j+ V/ g) G$ J2 t8 U: ?
}
+ w) w" f$ N! R* ^}4 [" m9 R+ ]$ M" p  r
</script>

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