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

|
网页之跑马灯文字特效
//修改宽度3 U! }, A$ O, f6 ^+ j! d2 r
var marqueewidth=300
9 v7 i! T C! o# B# j* F//高度
7 f8 J7 S- G5 dvar marqueeheight=25
5 @& I0 d+ n6 Z2 L+ M- K//速度(1-10)+ [) W" Y2 f# O$ T l9 p5 {
var marqueespeed=3( ]/ M0 |) ?! D! S
//背景颜色( e _& y! J: n& t
var marqueebgcolor="#FFFFFF"& `8 j) z, _, h4 n" [2 q+ D
//是否能暂停 (0=no. 1=yes)?
8 d# m' ^/ @* M* F) `var pauseit=1/ ?& B. Y* l4 L* u+ ]% p
0 q2 @+ Y* J% d" _- Z
//修改显示内容3 I0 x$ V/ i9 Z2 ]# R
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'. r% G- w! f# H* d% j
% W" E$ x t6 q# b
' Y) h. l% z _2 b1 Y
////下面不需改变////////////
. f: X% X4 K& _6 A: C; N7 n0 T4 c- e& t# T" F5 m( \8 u1 R
var copyspeed=marqueespeed
" v; N* t0 h. I3 @; ]var pausespeed=(pauseit==0)? copyspeed: 0
- ?( G# }1 m3 i( {# |) F- ~: svar iedom=document.all||document.getElementById
: V' k* Q$ F2 D( y6 |& Qif (iedom)
2 I- W: R/ L' H* M6 idocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
/ Z9 f7 p( D4 B+ w8 `( ]5 vvar actualwidth=''8 b. K5 x1 Y( N+ u
var cross_marquee, ns_marquee
$ U$ W- L' x( o" l( [6 p/ c
6 b( D* F- I; e3 Q _% q: pfunction populate(){: S8 E7 ^$ t4 U8 ^7 @) @$ J% d. p
if (iedom){# S7 J5 x8 m9 ?' q" ?- M: d
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
+ i, X3 [3 Y5 f T, ncross_marquee.style.left=marqueewidth+8$ `$ ^, h4 w% y8 g5 O& h! m
cross_marquee.innerHTML=marqueecontent
. u; S8 d/ N) }/ Vactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth( F' Y6 w- o( q. R0 e4 w
}
/ Z' V) f9 _9 P) Kelse if (document.layers){& N: R, i- m( R2 O) u
ns_marquee=document.ns_marquee.document.ns_marquee2% G6 t# R* B- Q+ i! E) _
ns_marquee.left=marqueewidth+8
; j, R# ?' O- G* _3 dns_marquee.document.write(marqueecontent)
) h. G6 J' A3 U1 T4 c; `ns_marquee.document.close()
/ U6 e, S, Z8 Wactualwidth=ns_marquee.document.width) f: L* c1 W8 D
}
) \4 z0 e y; L3 U6 I1 [9 l7 glefttime=setInterval("scrollmarquee()",20)# o% c$ h) W4 e9 k
}
# L" v& l) i4 y& jwindow.onload=populate7 n, D) H& n/ I; P" D4 h- E. x( V9 v
; Y; R, `2 C' v4 N4 ^
function scrollmarquee(){
8 q! g, ~* W! F$ X7 r fif (iedom){5 S1 O9 D- ] z
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))- G4 k0 n& E, t, i2 Q% |: L2 G
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
" n0 C3 U# S2 Oelse
- z# W" |5 F/ n% G3 Z3 \cross_marquee.style.left=marqueewidth+88 f! m. l) E7 x3 i
4 x' b9 i: ~, @' K. @ q u0 P}
8 W3 Q! C) d6 o+ T) U* Aelse if (document.layers){6 A! _4 ]( t L- t
if (ns_marquee.left>(actualwidth*(-1)+8))$ t/ [$ Y9 C& R1 r7 l/ m# t
ns_marquee.left-=copyspeed
/ d, M# x" Y% e* q Ielse
( o' a/ Y5 g8 [ns_marquee.left=marqueewidth+86 d- ^+ ]7 E2 Q: Q* C
}
- Y! [! s( P4 W/ r}
2 J- d1 u' w$ j. g. F( z+ A* ^# a7 w6 O" l& R. i+ q' i+ D1 k
if (iedom||document.layers){
( J: v+ J( F5 u4 t( x3 j+ Owith (document){% E- ^- w9 T/ _* H7 Q% H, ?4 O6 w
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')7 I" r+ f0 }( V E& `8 L6 k
if (iedom){7 i' z$ b' }! [3 m
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
+ C9 e' M& P, g( j6 X" H! B7 m) Dwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')7 j" |, p) [1 L. T! M& Q
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')% [9 Z1 B1 S+ Q4 l2 e2 K
write('</div>')7 O$ E" J$ `0 n9 i6 m+ H, w
}' k* r# Y; G: |' \" E7 L7 c
else if (document.layers){
0 G w' ^% j6 ewrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
; m9 r0 T! E( A! iwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')' C( C/ B9 w7 ~ f
write('</ilayer>')2 u0 x* D- f- Z5 S9 e6 ^$ a% M& X
}
5 I% l# n P, Z- \document.write('</td></table>')( h7 I$ I6 g/ |* g# @* s
}( V" y& Y. D9 g. Z+ J* ]+ b/ W+ v
}
9 K4 N/ ~8 V5 z$ U</script> |
|