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

|
网页之跑马灯文字特效
//修改宽度. y" W7 [" n/ F* h
var marqueewidth=300
9 ~. w* O8 c9 H( C& f% b4 l//高度8 V$ K. o0 j I, w( C2 _0 }" Y
var marqueeheight=252 k' o) n* }7 J7 S
//速度(1-10)
( O* V( K. l# I5 P/ D/ B5 a+ j+ ?var marqueespeed=3
4 Q9 h8 g' a2 y( G, X. M//背景颜色- X* }6 i7 T% k' k9 P
var marqueebgcolor="#FFFFFF": h' b" ?3 [# } j6 S/ C7 W" r6 X# v
//是否能暂停 (0=no. 1=yes)?
$ m( x7 D F; d9 R# hvar pauseit=1& Y! s' A. O3 |2 R7 S
3 g& Q0 C; K3 h2 y p( l5 p//修改显示内容
# Y( w: S- n |+ z3 M+ @var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
: B1 _6 N0 T, Q" }" _4 g* o2 L% `* Z* c9 D* c. C; q4 t4 Y
" ]* p v; X# c. Q8 x& R D$ G////下面不需改变////////////
) a! E' I. V. s. H/ f) P" c* P: @0 z; B1 H$ K% X! R
var copyspeed=marqueespeed
; O+ n5 o3 m$ {+ V. `4 wvar pausespeed=(pauseit==0)? copyspeed: 01 y: I' b% B' q' x" C- ^
var iedom=document.all||document.getElementById" g+ k# P7 p, G' \( y# @5 f
if (iedom)1 ?" z8 u' q' U0 |8 z5 J h
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')/ E% B, r& ?+ M x% p
var actualwidth=''
$ C0 T; L$ `# \4 v: Y0 C; B' Fvar cross_marquee, ns_marquee
. B9 c4 T4 _. z2 t$ @% R1 s6 a4 Z5 o% I! [
function populate(){3 \) ~5 ]$ B0 J! i0 r2 X! r
if (iedom){$ {* y+ D7 O8 C7 q; n9 O$ k* l
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
5 t+ R! R [% l4 |% ~cross_marquee.style.left=marqueewidth+8! H {+ T) t1 W% l2 v5 j$ r# M+ `- K
cross_marquee.innerHTML=marqueecontent
" J: t8 s* N# Lactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
# W" Z" k7 ]# q}
$ R2 X, J& o) N8 Uelse if (document.layers){
- Y$ @4 D2 i$ ^$ O6 Fns_marquee=document.ns_marquee.document.ns_marquee2% I, m3 T6 [ q4 Z- l* D# x
ns_marquee.left=marqueewidth+8
$ {# G6 m; |2 ~+ O. `8 ]ns_marquee.document.write(marqueecontent) t5 Y' ~5 e0 K, c% m' p
ns_marquee.document.close()
& D% ^8 i1 e! ^! Wactualwidth=ns_marquee.document.width
0 p" F, F3 @) t, U) E; A+ e}
) x, t3 L' }1 klefttime=setInterval("scrollmarquee()",20)
E2 c' \$ Y) N8 ]$ u1 ]; k$ Q}
/ { V8 L( C* O, T( dwindow.onload=populate
' ]- v' N3 ?" T1 T3 h" {* x$ C# K8 `; D% p1 H
function scrollmarquee(){
: i$ e+ C& h9 y0 Kif (iedom){
" I1 |. L. W8 ]8 qif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
9 I ^% Q' \. Scross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
& F1 e6 O" Q! I1 w r F" [% Pelse
3 f$ U6 o* X& Qcross_marquee.style.left=marqueewidth+82 P8 I+ y$ f& y. x+ L5 I% z
# I5 v( G* P) c; L) `}
* t& ~; n# H s$ q) m1 F- kelse if (document.layers){
6 }* A0 w7 h9 N$ N* Nif (ns_marquee.left>(actualwidth*(-1)+8))7 t. f) {# ^. c; z8 c
ns_marquee.left-=copyspeed
9 P. C- c9 f9 _" ^else1 G, U; t* i& U" b. D
ns_marquee.left=marqueewidth+8$ w1 \+ l9 S. y: S! v
}) P+ [( q) e: o# _
}
2 g; U9 [% t1 b: O( w% G
% T5 H' W: X! J# ?# Fif (iedom||document.layers){# Q2 n5 O; M- e3 ]
with (document){
; E* e0 b$ M; \; V; c, O a2 Vdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
7 l4 |4 N1 L2 M! V, ^if (iedom){4 R5 N7 X2 i7 `. D. u
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
( a& A+ W; t1 ]) Wwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
+ V# P$ S% ^2 p' Q9 Zwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')3 Z( x# S9 F3 t% R# s
write('</div>')7 b. J3 `$ w: l0 d3 E
}2 Y( C% d: \" T: R! U" T8 y
else if (document.layers){
7 P% H( z/ L# k- p' p4 b7 Nwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
2 [2 z3 t& ]. E: x3 Uwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')6 n/ V7 f' P* D" U8 m5 P
write('</ilayer>')
8 I, _$ I: ? G2 _! W. T: w}
i& s% w0 z7 ?( jdocument.write('</td></table>')
. t% r5 F- \3 z R# B}4 ^& l6 c0 C. j: b: r G
}
9 e5 }/ b0 w" Q/ j1 J</script> |
|