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

|
网页之跑马灯文字特效
//修改宽度4 T5 F' n; }2 h2 j, y7 J/ v3 d
var marqueewidth=300! C+ ]( W2 g h6 o6 [
//高度2 q, |& [8 H8 q8 }2 e* c
var marqueeheight=25% O; h$ D0 l0 M) q3 S
//速度(1-10)) v& L) ^" V. p; w' P2 P
var marqueespeed=3
* P w4 ^1 ^* Z7 |: r' U0 U//背景颜色
( K+ f9 @8 Y2 p% f, l" fvar marqueebgcolor="#FFFFFF"8 T6 D; i8 R/ q# V
//是否能暂停 (0=no. 1=yes)?, n* h( _! g6 c+ i; N
var pauseit=1# |: T" q: T" H; }2 M( B) g# T/ D2 K, w. j
, b7 h8 B/ V! I" V5 n: F/ t//修改显示内容
( l z b; j" }+ P- N! y" A- Tvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
4 j+ b7 t* o1 ^0 i% ^/ [+ _% }6 c: Q- e+ W$ S
5 C% @# b+ `, W* h& O
////下面不需改变////////////
3 O7 Z Z* O5 H8 F1 z
' @+ c' ` ^4 n- g4 pvar copyspeed=marqueespeed
# h- a/ i3 y( \2 b% C |var pausespeed=(pauseit==0)? copyspeed: 0
" W$ I4 K0 v6 A- L9 u, pvar iedom=document.all||document.getElementById" s9 H) Q" B4 t( z
if (iedom)
* A5 C; W3 I! {5 tdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
1 t0 ?2 w! D3 z) {- [2 A evar actualwidth=''
0 D1 z! d5 h% r2 avar cross_marquee, ns_marquee: t6 e2 ^7 y- ~; n) C
1 z2 U% k% c2 d
function populate(){
" E4 R2 m, U- u0 M B" Y. [if (iedom){- U8 V) A4 g2 S
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee) h, N! P3 w* l R' U! g& z+ o
cross_marquee.style.left=marqueewidth+8
) x: c* J c; p( @. M/ tcross_marquee.innerHTML=marqueecontent, R3 M! @; Q3 X5 q5 z
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth. O) q5 ?' e. A' J! j, d! f4 `
}/ _* R1 S- q+ {6 K) G9 W) @+ x
else if (document.layers){
+ j4 u0 Y& g. \5 ins_marquee=document.ns_marquee.document.ns_marquee24 R0 U" b! y' D, u9 g, n9 v
ns_marquee.left=marqueewidth+8
2 t* {$ g2 C* D1 y& _2 Qns_marquee.document.write(marqueecontent)1 { D3 }/ ~7 D+ j% ^0 n
ns_marquee.document.close(): j2 _ g: k/ l8 r" |
actualwidth=ns_marquee.document.width' Q" q# w) y* K$ y6 }8 ?; Z$ T8 F9 X/ ^
}
0 ^$ E6 f# w1 V6 X# T/ Klefttime=setInterval("scrollmarquee()",20)* W3 @' K/ P- M* L( y$ w8 K
}8 d( Y; ~ C9 w$ T2 I) f& |% b, R
window.onload=populate- o( @* n/ p+ n' Y% q# K
2 b& v- z* \8 J' k/ F8 i
function scrollmarquee(){
" v* \- q) B6 w9 T$ v2 lif (iedom){
5 e2 s, a4 l( n; G& @2 zif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
$ D$ t% a) ]+ i- K' }cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
- a2 `# G/ d8 R9 Q# n7 Ielse
" v% ^4 \+ O, L: Q; F; l7 n! L0 ^cross_marquee.style.left=marqueewidth+8
6 Z; d8 ?5 S/ W# l2 s! c. i: j& _. ?7 d
9 c7 x$ f, ?9 p}+ Y2 M# V" d8 _
else if (document.layers){
3 t+ l/ ~& J+ |7 i/ i- s; I: ]if (ns_marquee.left>(actualwidth*(-1)+8))
% u* o7 p A2 \9 N+ Jns_marquee.left-=copyspeed- N: Z% a8 \. k) W4 ^ U
else
0 o0 A6 Q2 h# pns_marquee.left=marqueewidth+8
8 f; p4 y. W4 [% ^) L* R1 c: K2 \}
% T' T7 v8 P; p. v. ]} ?% m' R! j' I: A6 ]% M K: T0 h
4 Y4 d3 ~, _3 G0 O4 g/ c5 Iif (iedom||document.layers){. \9 Q3 m8 K6 H7 j. H
with (document){9 t+ e; x' ~) l1 w6 j' B& _
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
; Q& d' P" S3 P+ W$ f3 ?# k: O/ Y3 Gif (iedom){
* m% a0 w, z w; @write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
$ c- D/ ~4 v- f. Wwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">') c2 K! n1 h# ^# @! ?
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
! H/ ~( J, L+ @write('</div>'): ~$ n$ n* X7 u0 z0 Z H
}( O- o- O' m$ f7 ?! u
else if (document.layers){
7 y4 N+ G5 }$ y( w9 ~1 nwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'); A$ f8 P3 P7 R6 e ?5 O8 J+ n
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
% {; O' L( h0 xwrite('</ilayer>')
3 _- d7 [- X) c8 L& n" W9 O$ g}9 \- B, s2 U% \( E
document.write('</td></table>')
( r- F& b' \! X. ~, z}
, H: I3 X7 W+ G# I0 g, U}
' `( F" }2 J8 o! Q</script> |
|