返回列表 发帖

网页之跑马灯文字特效

//修改宽度5 W& {* }' K/ M! |) ?* E
var marqueewidth=300
& m) m& i1 H+ f3 H& g//高度
( P" S# A, Y* V0 _* Lvar marqueeheight=25
5 o. W' f% ]: C//速度(1-10)% N* M; k/ I# w% y9 v0 f6 @
var marqueespeed=3
6 x4 U' Y+ x1 u) J0 Q) S//背景颜色5 t9 B: m& c- k5 y, O0 g" J; g
var marqueebgcolor="#FFFFFF"" y% C9 R, u/ k$ O' b
//是否能暂停 (0=no. 1=yes)?
3 A+ n8 _' r* ^* F; Z% \1 lvar pauseit=19 g1 t+ D% |) z" C  B
: F; n* O/ G+ D- m( Q4 u% j
//修改显示内容3 f- D2 \* L4 o0 q" o5 n- g
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>') m# F0 U- Y! D' M% B4 Q, \

2 a3 B# p+ s: u+ x/ C- Y9 g5 O7 x, O1 c# M. c5 a6 r
////下面不需改变////////////% \) i- I# X% F& U; m$ d1 c/ Z
# _; M% F6 e: L* v2 Q! J) B) A
var copyspeed=marqueespeed
( ?5 ~7 R3 @- _& C2 X8 O1 ]! Uvar pausespeed=(pauseit==0)? copyspeed: 0
3 V& X/ i0 J1 E9 {6 r- V7 rvar iedom=document.all||document.getElementById. {) C2 b& ]8 p( u- f( K
if (iedom)
3 R+ _( {6 b5 U( u: Fdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')0 X4 ?. t5 o- g: _' J8 \6 d
var actualwidth=''8 r( p; Z8 E( R" C
var cross_marquee, ns_marquee
7 i1 R5 d1 E, c# b; j$ m8 g$ q+ R/ ~8 P! b% b# t, u# L1 a, R5 f
function populate(){& z' g( ^: m" i3 E1 |: \, `
if (iedom){
, L8 \! L6 x: S( N' ccross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee% R; I# ?% p4 _" [3 X3 z6 f
cross_marquee.style.left=marqueewidth+8' n  c8 M# k) o; U
cross_marquee.innerHTML=marqueecontent7 X" a- L0 I) G4 T. c8 l
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth! d" e$ o2 o6 `  x
}
1 z% `) Z! K7 ?( w8 ?) jelse if (document.layers){4 S5 Q& H; r( C) m! w
ns_marquee=document.ns_marquee.document.ns_marquee2
4 O, f4 [& w0 K5 Hns_marquee.left=marqueewidth+8
5 Q+ r  c, a- B: y0 t  Ens_marquee.document.write(marqueecontent)
3 y' d4 w/ {4 n/ d& f& `ns_marquee.document.close()
' R# f# }  k5 e4 j# F3 p, Q" Qactualwidth=ns_marquee.document.width: [3 L3 R  k, S' x3 e
}0 U7 A4 W: Q1 W* m2 A+ n6 k
lefttime=setInterval("scrollmarquee()",20)
% h* j" D/ Q: [) Y2 V  e}. T& x# {3 G* }8 L. u+ _
window.onload=populate
* w8 `8 r/ O: k1 t# c5 T' A
$ h" I9 `1 v5 C3 X& Z0 `; v( j) ?* p# qfunction scrollmarquee(){
$ a* A7 t6 V" _/ ]3 M; V. }if (iedom){+ A% e& Q' C* R( {- L$ P
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
- w* C' N6 X- D. `7 _cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed$ y- l5 V& c3 B
else
  s+ n1 P) H! S7 }cross_marquee.style.left=marqueewidth+86 z  M( S/ A8 D- ]" _$ Z  r

; }' ]. @. G5 w2 e" f}
+ H3 g0 p  U. U' X2 ?else if (document.layers){
6 [) T  K& f7 s0 Aif (ns_marquee.left>(actualwidth*(-1)+8))
2 Q. v: M4 t+ k+ _1 ]ns_marquee.left-=copyspeed5 x) R% c5 P) E: D% m
else
- k7 t6 h) t  E2 b! Y3 Ans_marquee.left=marqueewidth+87 i2 p! P3 B: k1 _" J; Y4 c
}! E5 j* W# n& l1 ?
}
( ], r4 w4 w5 @! A' _9 J; [) C
3 x; |7 y& Y# Z" X; _9 u0 Xif (iedom||document.layers){
5 E6 R5 t) `2 z; t; Z1 Q8 Nwith (document){
# g, }$ Q. H) }8 Gdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
  @: h/ x  y- p8 Z+ Z1 iif (iedom){6 f$ n: Z5 h# ^$ J
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
8 M& S6 H% m2 jwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'). q3 l' q! S5 ]) X4 m" C/ R
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
1 c, `. Z0 T/ s% p- J' W; P. }) Zwrite('</div>')
) e) \9 X/ Q6 J6 {% `. C4 i# Z}: |' B9 x4 c. U0 y
else if (document.layers){9 @; v0 n6 f% e* s5 r" n  w
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')% e: O- o' V6 P1 e" [
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
* K: g# Q& y+ b  Vwrite('</ilayer>')
" ?, Y" f% i. m" R}: x) Z. |- T' q" V
document.write('</td></table>')0 `2 \; J- F# W. B' i# B( Z
}9 U8 B5 Y5 f& g1 [
}
  `  C! Q+ s7 c</script>

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