  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度1 e. ?2 i: i# h# ]/ l$ J
var marqueewidth=300
% S7 \7 T4 S1 D' b//高度% U2 }. W& \0 h0 f
var marqueeheight=25. o' ?7 s' I* o; S" l" }
//速度(1-10)( e5 W/ M: Z9 p$ K9 |+ Y
var marqueespeed=3
1 A U' x/ g$ C2 d# V; F& @# r//背景颜色8 k4 U u# ~# C* a
var marqueebgcolor="#FFFFFF") L: X3 b. [& q0 W( {
//是否能暂停 (0=no. 1=yes)?6 [/ z8 R: @1 D' @( J! j
var pauseit=1
, s% _) v9 Q! i# }, @% `
0 V' K P4 f" {, q//修改显示内容+ Y! _! i% Z, V, l
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
6 f2 E1 b8 E6 e( p2 ~1 Q `. q* ]+ o, C: I$ P
& [. [) W$ ^' O2 F r. L( a# S////下面不需改变////////////
% ?0 U" h( i+ X2 G/ y" P9 ]. u2 P/ P$ b" z
var copyspeed=marqueespeed+ `, N+ a) u4 R. _6 A
var pausespeed=(pauseit==0)? copyspeed: 0- V: p: I2 N. U* _
var iedom=document.all||document.getElementById I3 @% y, S6 J, w
if (iedom)+ f `1 ?% i! d: ]7 U' p
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
9 t! U# M$ d. p. o j2 l# lvar actualwidth=''4 f* d4 t+ x! c- M3 e5 _
var cross_marquee, ns_marquee
+ |7 b4 }$ q1 y. t, V1 b7 y) t6 {- ~2 w9 i
function populate(){
# d# H" ?) {! s( e" v0 u$ s( W7 f+ ?if (iedom){
% b. X0 h: B9 p bcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
2 c# E7 c$ j& Vcross_marquee.style.left=marqueewidth+8
" i/ m; r2 ?2 b/ u5 M8 X( Dcross_marquee.innerHTML=marqueecontent Y) \* c0 h( I0 S) O$ X+ s5 q9 _: b
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
' `9 t; O5 z2 D' t* ?}
# M* m! D- X4 \8 H5 j: Kelse if (document.layers){3 Z* o. S3 F, V3 C% V; C
ns_marquee=document.ns_marquee.document.ns_marquee2
3 x0 l8 a# x0 U$ \& Q* O! T0 Yns_marquee.left=marqueewidth+85 y9 `) ^! h& W8 }' _/ d
ns_marquee.document.write(marqueecontent)
4 u! Z: x# V/ }9 Mns_marquee.document.close()
: A; N, w. H; A* X t0 iactualwidth=ns_marquee.document.width
: H) y* e3 z9 S5 v: b$ b% R; g- H}1 b0 c: h6 m1 T" b) j2 ?4 p- j2 i
lefttime=setInterval("scrollmarquee()",20)
2 u/ G# o I0 X- e}/ \( [3 k6 H+ Y, }$ \
window.onload=populate
3 I# |* l( S" g* ~ Y4 @0 P3 M5 J
function scrollmarquee(){
- p# J- D9 v/ ~$ i% Uif (iedom){0 G* d7 u; E5 y1 V4 E$ ^5 H
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
! A) g2 S* H- `cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed3 Y( x" Z: g& F* L5 g
else& o8 i/ X; w6 ?% \% O
cross_marquee.style.left=marqueewidth+8; [/ j B, i, _; U8 W) K1 x7 @
3 c9 P5 ?7 |1 D) \1 o$ _1 c}( \6 d4 _, S6 q5 s o) Z
else if (document.layers){- X2 _. ?& k/ s2 _5 ~
if (ns_marquee.left>(actualwidth*(-1)+8))
- @) M! q/ }; F6 d4 o7 O8 d, Sns_marquee.left-=copyspeed+ X" O, Z* f4 [) \$ W R
else. T3 c0 {5 C7 [/ d) K2 S4 Q
ns_marquee.left=marqueewidth+8) K r6 [) j& U3 S q, v: C
}/ E) A0 P' Q5 R0 W
}
1 m8 {% S+ z7 o- W% m+ Y4 o$ c, n" @; p5 G( ]4 Y
if (iedom||document.layers){8 ~) M% p: H$ }) t9 _
with (document){
1 a S X1 M* V ~8 J" ]8 Ndocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')$ O' x5 X. w, ^
if (iedom){9 M. X k. c, Z
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
, w# t) Z. x+ j) Jwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')1 v6 X8 ]* O' K3 w( U# q7 t+ f( A
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')1 `. t4 o: t% ^6 A
write('</div>')
% [: J% Y& x: w: ~. ^( L1 d}
2 f9 K) M2 X+ {8 C/ @& X$ u* Jelse if (document.layers){9 ^, Y3 |7 ]/ g' K5 u8 D1 L1 {- R
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')0 }% W& g: ^1 W0 c0 P
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
/ @2 E/ L4 r5 w2 @4 P, j8 wwrite('</ilayer>')
8 f4 A) Q# {& b' x+ n- F}% |' X. Q0 W; s7 s. b
document.write('</td></table>')
. j8 v: W4 y) J* ?# r! _% k}' I5 ]% v; X+ V7 _9 w7 z# y' A6 s
}0 k7 I E j1 a1 B B% `
</script> |
|