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

|
网页之跑马灯文字特效
//修改宽度! Z7 z1 c0 l! d: w5 ?7 k
var marqueewidth=300
1 H6 R! o: J C3 B5 ^* L//高度! A0 j9 g# r2 ^4 _, a/ N
var marqueeheight=25+ y' S) b0 G+ r0 N, ?2 G! ]& i
//速度(1-10): W3 I9 n. \6 {' ]% z
var marqueespeed=3
F4 }2 F2 R0 U9 f- h//背景颜色* C+ A( E2 k2 K9 _! m9 G
var marqueebgcolor="#FFFFFF"
; ^. L8 {/ Q' U: @; `2 v" Q//是否能暂停 (0=no. 1=yes)?
! H/ x1 Z! o. C* q# [- W6 wvar pauseit=1; h0 M2 Q! z' h, z3 _8 k9 a4 r
- ]4 @( ~9 y3 o; V* Z) K( ~
//修改显示内容6 P" g- A8 t( e1 V0 Q# ]2 ~5 o9 u2 B
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
/ [% @2 B2 l6 i! M& H5 f1 h6 e9 d3 \$ f5 Z% v5 H
- b# i+ A7 [. T. J$ U+ G
////下面不需改变////////////
% V( Z! F7 [: I6 r) b6 G' W& q1 _- o2 K) l5 j- d4 O: S
var copyspeed=marqueespeed
" ?, b, a$ o5 Q K( |! cvar pausespeed=(pauseit==0)? copyspeed: 0& d7 h2 J- W$ d& [2 H
var iedom=document.all||document.getElementById
" p5 e, ~7 w) ^+ N' i. I6 p" vif (iedom)
8 Z! ?( }1 A. b! ldocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
; v: E; e R0 a& avar actualwidth=''
/ m& s/ w. X4 {5 nvar cross_marquee, ns_marquee
! j3 V8 k$ i' o. [. U5 t D5 x8 J! D9 n9 z O9 f$ ]
function populate(){
* V* ]4 A, m& P, U, t3 g1 q4 qif (iedom){
, c& I) G; h* U- l+ [7 T# t6 bcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
4 [3 P2 A. b$ r0 _& ]2 ucross_marquee.style.left=marqueewidth+8& |# |4 H; A+ O5 W6 s5 f7 p& G
cross_marquee.innerHTML=marqueecontent `, Z8 a, E2 n+ m8 o
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
4 g/ h6 F1 C& X. j2 o' f3 y}) S4 ], _3 p& A+ {; u6 y0 ^
else if (document.layers){/ y2 z/ J3 Z+ {& p$ }/ r1 w2 K& e
ns_marquee=document.ns_marquee.document.ns_marquee23 m0 K `% C+ R- N. g
ns_marquee.left=marqueewidth+86 |+ d( @) q) S! N2 ~
ns_marquee.document.write(marqueecontent)
4 q8 H, ^8 I* w" I) `# H! o/ zns_marquee.document.close()
7 j# |% Q0 O" \$ \! O/ D9 g5 Dactualwidth=ns_marquee.document.width
# \" ]5 z$ R$ g% E' O! H+ I7 ~}# U* W T- S- B% y2 o3 k6 [' w
lefttime=setInterval("scrollmarquee()",20)5 _9 N/ Q) o" V: c7 D7 w) I: `
}/ w0 e0 p, U, N; P& w7 A' f
window.onload=populate% j: [) ?0 @: b) z' F
% N& b; I% T: X7 W) x2 p8 Ofunction scrollmarquee(){
5 M9 [1 s$ j4 e6 gif (iedom){
6 A% U8 G% _* N0 D. [% Yif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))/ l( r% n4 I+ |' N; u3 j4 n$ \
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
6 F0 R1 z& y9 B1 l( j2 O* zelse
" l' m* ^. F! L" J; [! s1 F8 Ucross_marquee.style.left=marqueewidth+88 p! T: U8 O0 x* ]+ V, o& E
7 K' A2 D M" r; @5 h
}6 M/ M9 O2 s* T% a" ^
else if (document.layers){
) Z$ m; ^. |1 R, K3 uif (ns_marquee.left>(actualwidth*(-1)+8))
1 y4 S0 n3 {$ ]& p8 k8 Ons_marquee.left-=copyspeed" l& N- m8 o8 ^1 B. q
else
! p! B4 U* s: {5 `7 L6 E3 dns_marquee.left=marqueewidth+8! Q) k- g8 i1 n8 x
}+ g$ M! s: o' `2 U+ R& T, M
}
) _- Q/ o4 X/ n8 I$ S
, `8 P: S. P0 S5 X# r3 sif (iedom||document.layers){& P- \" f& h! Y2 z: p1 t
with (document){' z7 ?$ M! m9 v, z8 C, J) a
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'); ]2 V1 S3 s7 C; t7 p
if (iedom){, g1 n) O w3 ^; X4 h
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
" D) o! H$ l! b! ~3 o" Q2 @write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
: N j# h j# l$ Vwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
u! [( o6 d9 ~$ \write('</div>')
% N! m' M! R: G4 Z4 M3 s}* L+ ~: ~/ a( U) Y( H7 j4 z& F2 t
else if (document.layers){. F' F6 j# j2 L. s% ]
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
( I1 c1 ~9 d* |0 y" Ewrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')# l8 j1 R( O1 h* X
write('</ilayer>')& X' G! B* R+ Q7 V3 `* p8 P, @
}, p% o& R# L2 ?. W7 {" y
document.write('</td></table>')
$ _& x, I3 f8 }4 [}
+ K" g& s, p7 Z F% x% l' _3 t}
3 y4 v, u5 R7 Y0 \: c</script> |
|