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

|
网页之跑马灯文字特效
//修改宽度
# ~& R$ i y l7 P# B4 evar marqueewidth=3004 [8 Z. |" T1 l) D
//高度& ?6 P; f% a. v% [2 [
var marqueeheight=25: y8 m! V$ m# h3 _
//速度(1-10): W7 ^1 |; n6 j) f. _( A5 i
var marqueespeed=3
; {7 k% x3 @$ |5 ]- X9 Q" |//背景颜色$ B0 S: S) F) _
var marqueebgcolor="#FFFFFF"6 ^- p+ t6 X5 t# G$ ]4 s" |
//是否能暂停 (0=no. 1=yes)?& b! I h! K6 S, N$ [% [8 V3 Q& b
var pauseit=1
4 n- w( D1 w6 [
: f5 h M$ l) @4 l//修改显示内容
5 u" V0 s7 K+ qvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
# D/ a. d' E0 ]2 ~
% U( s/ t$ R# Z" J) {, T0 v4 @5 }. n$ k9 m
////下面不需改变////////////: j& q% a: P7 G- i- ^8 H$ ~
% h$ z* i5 Y) Q: T; yvar copyspeed=marqueespeed* b/ R& Z, h. G. Q H: r7 P
var pausespeed=(pauseit==0)? copyspeed: 0
4 h; M0 M, z7 L( A1 g6 Q/ u( svar iedom=document.all||document.getElementById
9 ]1 m2 ?. V; l9 H. Dif (iedom)
# \7 f! \1 P4 ?$ Qdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')* P- h4 x# w2 }0 Y
var actualwidth=''
8 S! B* j8 P" c dvar cross_marquee, ns_marquee2 I6 f) B6 U, q" \0 [& Y
1 L6 ?$ v( R: P: E/ m
function populate(){
5 d6 x: ~4 ?9 D4 J* ?( Zif (iedom){
- \1 x9 |0 ~% a- v5 [2 n5 @cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
( n! b b5 p- c& Y. [3 N, O( ycross_marquee.style.left=marqueewidth+89 y- t4 G* x6 `1 g/ T8 s8 [
cross_marquee.innerHTML=marqueecontent
* n2 ?' b; X# K& f# \actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth9 R9 B0 U0 y" P
}
' [( `0 R8 B- D4 I! d' Telse if (document.layers){
6 B# I9 \* c8 t4 K. f( z% Mns_marquee=document.ns_marquee.document.ns_marquee2+ D4 O; W) Z, b: D0 c6 c6 V7 i$ e
ns_marquee.left=marqueewidth+8" i: Q! x4 U+ u
ns_marquee.document.write(marqueecontent)
" o+ \" S( \! |. cns_marquee.document.close()7 c+ \3 e3 y$ Z6 p. t5 S9 S- O" r
actualwidth=ns_marquee.document.width
) ^& f6 b* S0 N1 @& L}
3 v" S8 T1 E7 ~0 x" E, Rlefttime=setInterval("scrollmarquee()",20)
8 ?( @) y# d) b: D}
9 ]" _8 {) l2 ^- Twindow.onload=populate, b- J0 ?/ |4 r" P! h* E
1 {) I/ q* P/ ~2 R
function scrollmarquee(){
2 ?2 ^. q& k! k2 {* {; qif (iedom){
$ x7 d U6 m$ Uif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))- t b* v: z1 _7 n+ x# W5 O2 v' O
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
( m' |2 F k0 f9 K+ k6 `& ~else
+ O* N4 i; n% k0 V* Pcross_marquee.style.left=marqueewidth+86 R8 k3 e8 g. }* d6 C+ a8 @2 c
8 j/ Z; I+ [$ k7 \" m}
! u; [" s# N& u% t, t: c6 ~else if (document.layers){7 `, N% s j7 c' M; `. x, j
if (ns_marquee.left>(actualwidth*(-1)+8))
9 m# I a7 J8 T0 N" M& tns_marquee.left-=copyspeed( N8 x: N/ J6 z% n6 V A& d* @
else3 d6 S7 F4 D! v1 l
ns_marquee.left=marqueewidth+8
% m. ?, m% K. u l# Q6 s}1 |4 d4 o d& _* S2 b0 s8 r1 ?& z8 n
}
. m/ c/ b: f8 v2 k7 i
0 h1 c+ {. O4 i; Q. U8 Dif (iedom||document.layers){
1 t O( K, H5 T5 s. [with (document){1 ]8 V1 G% u$ Z
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
5 `, O5 m( d8 y$ j7 Gif (iedom){
5 _% r0 \% J) F' I! Q. pwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'), F5 t- {9 o6 n3 S/ x4 u9 N, M
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')# G8 d( V1 }; Q2 o
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
9 J( R1 A) z+ w* _- Dwrite('</div>')- R1 m- X$ K7 L2 A( w6 w
}. j0 c7 R" H/ @* d0 ]$ }4 Z6 w- a+ @; P
else if (document.layers){
8 B9 B6 Y4 p5 o# `+ G4 q* L! Gwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')! q: c( m! P; |! |3 u, |+ q3 A$ o0 \
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')" y1 l" \0 ?6 N4 A! p5 F6 _
write('</ilayer>')
5 W; @( ]) S* ~: m: }. U2 o$ C}
. f4 U# t7 I, R# F' h9 H. f% Udocument.write('</td></table>')
' X7 O% E9 f5 z, T4 y}
% a, z: f7 S' k" u}
- \( e. } g" o5 {/ Y4 G' ], V</script> |
|