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

|
网页之跑马灯文字特效
//修改宽度
: `6 R0 O% u9 P. Ovar marqueewidth=300
* s( {! M1 G1 u" \3 B/ R//高度 D5 j* |6 Z' X: c
var marqueeheight=25
2 H7 h% ^) K- O, x* d//速度(1-10)
0 k! h0 i" Q6 A2 x, |& l% kvar marqueespeed=3
/ ~) E& }: Y1 u: t5 O; y2 b$ W. s9 i//背景颜色
# B* O8 c+ t( ]var marqueebgcolor="#FFFFFF"
8 C' q! y: @- U* }& R/ l//是否能暂停 (0=no. 1=yes)?) B/ G! L3 b6 `! f" |. b' U
var pauseit=1
; F9 x7 u$ X$ i0 L6 o, l6 G. g2 B0 q0 ~& \8 z. a
//修改显示内容. l% c7 q# E" N8 U" R1 S7 X/ l
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'% L1 @5 o, Z; n0 G/ y
' t* G, z9 }3 _- S- I4 t2 [6 a" ~3 }8 l* X9 n: L
////下面不需改变////////////& S3 b: x/ O3 w7 O7 B
% G" e; ^5 ~2 d% e) mvar copyspeed=marqueespeed: j1 Q; z$ w7 Q) w( f) @" W! t0 U( F3 u
var pausespeed=(pauseit==0)? copyspeed: 0
2 e! @6 f, b# R1 o. Evar iedom=document.all||document.getElementById
1 x2 E; X' \' S1 L; Vif (iedom)
7 h9 P5 N( S" y0 U- H6 M) Ldocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')" U& P6 o- ^8 j8 F
var actualwidth=''
* @+ f: F; o3 a x$ Bvar cross_marquee, ns_marquee
1 k% H* K$ k! g8 w& Q# X" g# l8 f l6 j
function populate(){
- p5 _1 O0 w- ]3 `if (iedom){2 ~7 N- v, K# B
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee% }7 w# x& X0 c# o" B# i' D
cross_marquee.style.left=marqueewidth+8
9 a4 l7 i% `5 l$ D- z! mcross_marquee.innerHTML=marqueecontent
0 v9 Z, I4 h7 j ]: \actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
. C X$ h: K# }: E* }3 `, ~- o}
' t: H1 w, J1 G W* o; \2 W% Ielse if (document.layers){7 }: u9 a4 m$ I5 r3 U. Q4 I: g) q
ns_marquee=document.ns_marquee.document.ns_marquee22 T: X v* X% [8 r7 ]
ns_marquee.left=marqueewidth+8
7 L) T* x0 M. S1 N6 m, k3 k) Ons_marquee.document.write(marqueecontent)
: @1 ^6 p2 v; b7 j! k0 d8 Wns_marquee.document.close()
7 V- l& `# h, M9 N) uactualwidth=ns_marquee.document.width
8 i* w* m( D. p}
$ x: O$ s8 W+ q/ d; Rlefttime=setInterval("scrollmarquee()",20)8 h8 V' [2 x5 {2 E2 w
}& M5 _" N" Y2 Y4 k9 Z* k" l
window.onload=populate
9 I A- `( o; S1 |; O* J0 J a! b# X) L L' ~
function scrollmarquee(){
8 ~- c B7 ]- Oif (iedom){5 h$ h- l% D C# e$ R
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
7 P- G' p1 H; b3 Hcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed) L7 f" H) I, x6 i
else) i4 ~7 R9 ]( x9 L+ `
cross_marquee.style.left=marqueewidth+88 Y' U0 w4 F, [* |/ \
2 m% s0 `4 t' C2 c
}
$ L+ W; R5 d3 y% o& [ H4 B1 }2 Z( Welse if (document.layers){
$ H5 X) w/ D2 Uif (ns_marquee.left>(actualwidth*(-1)+8))
2 B2 q4 u9 r6 \: b9 y- yns_marquee.left-=copyspeed7 b, ^9 Z8 r* t7 T+ u5 }
else! t1 g5 g' `/ q
ns_marquee.left=marqueewidth+89 H* P& p+ D, c2 q0 ?
}4 ]8 L3 j% H) L5 ]9 k8 ]
}
9 P3 [% {$ I5 _. w7 s3 q6 r2 C8 w/ w/ D; @4 X% c! ?
if (iedom||document.layers){
9 L n: s& I6 f# V3 W7 R2 }with (document){
3 F3 j/ N% p$ i/ H/ idocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
( r+ T$ A/ Y+ o$ x3 x& Tif (iedom){9 [5 u# D; U6 P/ M8 O6 e
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
% L$ D" O- F% N, W, [6 _write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
, q3 Q. x# K& `4 C2 Y. @- `write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
* f4 Z1 G& z7 e) i! Cwrite('</div>')
* q w. Q, z$ {1 K, y+ e}+ p% \+ u0 K# [) A/ T' _
else if (document.layers){
% f6 ]: x: V. R! g0 [8 p1 hwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
1 {3 k+ l1 m3 e0 A, [ owrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'); h; v6 B1 X4 x* h
write('</ilayer>')
& z; i1 b0 k) v3 _# P+ D( [! i2 p}
$ W2 A4 L6 X8 |' P- R1 B, ~document.write('</td></table>')
2 I9 h( \6 j$ U& ~- W8 X}% U9 |1 Q8 n8 M; w9 o u! M' e
}5 ]6 ~* B: |# k) L2 J" S6 `7 ~1 e
</script> |
|