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

|
网页之跑马灯文字特效
//修改宽度. ]* X" [; a) B6 B5 s0 T
var marqueewidth=300% C+ H- d2 l' d0 q
//高度0 l2 a# A. M0 ^0 n
var marqueeheight=250 S! ~# L, d; I1 D' |
//速度(1-10)6 h. Y- D3 J1 z( G+ e! }* ~" k! A4 s0 X2 k
var marqueespeed=3: m4 e5 z# n; x: P
//背景颜色
! j* [: ~1 X h. k: evar marqueebgcolor="#FFFFFF"
' P. W1 L3 n: X5 e//是否能暂停 (0=no. 1=yes)?
6 J3 r( f; g- j" Jvar pauseit=1
" k" ?! D2 D- B7 S c4 |$ k& |
8 {/ N$ }" X0 T) h4 [9 N//修改显示内容+ Z3 Z* p$ v' y8 P* `2 o/ X
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
5 L. J& K& d% p/ I" B5 t9 E: L: l( O1 X4 \& }7 W) i4 P
* J! W4 m7 q3 f////下面不需改变////////////
4 x, s' M- { O# L0 @$ u$ L1 L3 }0 J- ?
var copyspeed=marqueespeed5 V2 r4 F$ A( A7 V5 s# J$ f
var pausespeed=(pauseit==0)? copyspeed: 07 J. [* z2 p8 N
var iedom=document.all||document.getElementById
7 t4 B& g$ B/ S% ]if (iedom)
) j( |( r4 \' i3 bdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
) F) O& z7 z1 W( M/ E4 lvar actualwidth=''
9 F* b* ~" Y4 \6 G) B, F6 A( avar cross_marquee, ns_marquee
3 L' U0 P5 j; X2 E5 y1 N f+ t/ X+ J% h- F( Y! b9 G0 ~; X7 U
function populate(){
1 E8 B5 s7 x5 M s& cif (iedom){3 f4 E; C* u! g1 a
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
R8 `. u4 J3 W- _: y4 Xcross_marquee.style.left=marqueewidth+8
R3 O( ?# ^5 y. vcross_marquee.innerHTML=marqueecontent$ s% Z4 K/ r9 c
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
: N' F2 \' d1 v' X; ^}
# `: Z+ F1 Y5 Y( ?8 G* V4 |else if (document.layers){
0 G& S+ A! v6 N7 Qns_marquee=document.ns_marquee.document.ns_marquee2
! n8 ]1 K7 q3 }, Ons_marquee.left=marqueewidth+8
& K( r* ^, g$ F6 p, `% mns_marquee.document.write(marqueecontent)
6 S+ c: h' {8 {+ y5 ?3 Tns_marquee.document.close()
# H7 p& ~& X8 Q# g2 \. Yactualwidth=ns_marquee.document.width9 o7 d, B: ]* O( l; _, u( b- e
}
" Y4 C+ F: U$ L* glefttime=setInterval("scrollmarquee()",20)
4 E2 r+ C: o$ r& `7 k& q}
' h8 p' ?& W9 p2 [1 V |: S/ K; Jwindow.onload=populate" `, V. w! e; ~% V: ~4 N
) L9 V- u0 z. i/ rfunction scrollmarquee(){7 u) V9 Y! i/ s/ V D
if (iedom){. C A {' |" Q# P, {3 z
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
, Y6 V( N2 J3 Fcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
& d; w& M3 M9 D0 xelse
3 L% X0 B7 {3 Q4 D4 }! Xcross_marquee.style.left=marqueewidth+8
, |% \: D" v5 ?- H6 _/ o$ m1 H
1 x# p! f/ ?* X# B}
% g. J# V# z- }else if (document.layers){. D4 B4 W4 ] I$ o; u
if (ns_marquee.left>(actualwidth*(-1)+8))' u2 F& L9 g- y" y
ns_marquee.left-=copyspeed! {: d/ W4 M6 V) R3 g% B* b+ q
else3 Z% z9 s) l) |6 e2 \. k
ns_marquee.left=marqueewidth+8
. _+ Z' s9 T1 e7 a; A: @/ `% Z- A- z- G}: l; [# y" ^5 `+ H0 }
}
5 V- I& J9 B" x! }$ q
3 L+ I" j, f2 U3 Sif (iedom||document.layers){
4 o, N) v1 z0 n3 e) u/ Z$ B9 mwith (document){
% U5 Q; s" ~7 D3 B f7 @( ]: Z; ^$ Tdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 l9 }8 a/ w# T9 z3 q/ p0 N
if (iedom){* @2 x) E* P" E* c" ]3 X9 Z2 q
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
?0 L- s. H0 Z8 d# xwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
3 L; |6 n$ a7 m& Dwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')3 N! d* }) G2 b3 Z
write('</div>') u& v O2 P) Z3 N2 R. P& [3 ]1 {1 e0 R
}4 y/ q0 K+ t- P+ y1 h
else if (document.layers){4 d, ?% g f" l0 e
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')+ c; v, @) |$ p1 J1 c
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')/ j9 w$ ?% d4 e
write('</ilayer>')
4 Z- H4 ?& {# }+ n* q( X/ ]}
# o4 v: h: z7 u+ m G% @document.write('</td></table>')
1 w, v% g1 m) q8 f}
4 G. V8 B+ c9 H}
J1 h- i. M1 x7 M( k- R. v</script> |
|