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

|
网页之跑马灯文字特效
//修改宽度
6 [. d |2 G9 B% E" c8 jvar marqueewidth=300
1 k( s9 e, Y7 ^# d; Y% Z5 r//高度
3 t/ n/ M0 ?3 O8 t# d9 c& vvar marqueeheight=25
9 i4 t$ d$ u5 Z. X//速度(1-10) S& m& M ~) P0 x! F8 e2 R
var marqueespeed=3- W$ c2 H* H1 B3 J3 Q
//背景颜色' T, S! T* T3 t1 F s9 d5 O1 B% p
var marqueebgcolor="#FFFFFF"* X) Z4 _& ]% |' E( z: N
//是否能暂停 (0=no. 1=yes)?
7 ]/ F) l( @4 A) b' ^var pauseit=11 ~$ I/ m+ y. w
, x K9 @2 g5 F7 [- P" x- W9 `//修改显示内容/ n/ ?8 A W4 O% T3 ~& {/ K% N
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'3 U& W+ D3 f$ ]- h4 @# H1 q1 R/ O9 g8 N
& o; m' X4 d5 Q$ Z1 X( l+ H+ Q: f: m0 `' d$ b
////下面不需改变////////////
0 y) c! M2 p$ w& i1 Y7 \: L9 c- i# b) d
var copyspeed=marqueespeed
+ x8 _; v5 R; W' zvar pausespeed=(pauseit==0)? copyspeed: 06 g, A( s' a( F1 Y& P; E
var iedom=document.all||document.getElementById0 g0 A0 q' Q; f4 _7 f3 i
if (iedom)
% u1 v/ G) Z: ~document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')0 E% `( K# G$ H: J8 J6 r
var actualwidth=''
8 J6 q" s. D4 a: k% ]+ Ovar cross_marquee, ns_marquee" ]7 {& e6 \ {3 J2 V1 v) M
- k& R, L( f6 P; l
function populate(){4 M. ^$ K. y o4 {# X
if (iedom){5 S2 H; Z# a- ~/ {* d
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee5 h9 l$ F+ {# G: k/ i
cross_marquee.style.left=marqueewidth+8
5 {: Z- ?2 O/ S& t0 N* J* ?& W4 ccross_marquee.innerHTML=marqueecontent
. o# I- P2 x. T% C& wactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
8 H$ F# j2 ^) O# ?4 B# Q g}. K$ c) W2 I+ C3 b4 q
else if (document.layers){
7 i: g7 J+ o" w# a# r @1 Uns_marquee=document.ns_marquee.document.ns_marquee2
; w+ j- A# b0 y! a, }" w/ ins_marquee.left=marqueewidth+8
; K8 W$ {6 X: t5 B. rns_marquee.document.write(marqueecontent)* k# E/ ]* f, A! B
ns_marquee.document.close()/ h4 V# k9 A4 Q$ T* g$ g
actualwidth=ns_marquee.document.width
5 n j, C6 Z1 r ?}1 l* `# S: D' ^
lefttime=setInterval("scrollmarquee()",20)9 h. `, w% P# f5 _ Y
}) U7 Q9 f1 y0 O
window.onload=populate" b& m5 c7 }) K; B
0 K+ r" p9 E1 L \: mfunction scrollmarquee(){
- D8 |) k W; }% [if (iedom){, i+ L- j: o# T/ D6 G6 x* a0 K
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
7 f2 V4 v: W# C8 m3 i8 kcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed. R5 k) W+ l6 ]9 t3 g
else
" [ j% y3 ?/ A" P8 d, q' s' gcross_marquee.style.left=marqueewidth+8
+ p9 y8 E- |7 Z1 m- [; |4 j& M
4 ?- a- O x$ j9 S0 C7 l0 @$ J5 B}
. f, K- S" A( z" selse if (document.layers){2 G4 S+ W, S/ B* K4 r5 ], E
if (ns_marquee.left>(actualwidth*(-1)+8))- F- A6 ^3 `* x1 M& u
ns_marquee.left-=copyspeed/ q- ~' a$ b, q$ X$ W% f
else" ]( \- f6 M$ F5 ^$ B0 d6 L4 |
ns_marquee.left=marqueewidth+8
, \* N" o. B. x& H# B}. k& j6 K& g$ D1 u2 h
} e$ I# D3 T% {5 \) _7 C# e
8 s5 I% l4 ^1 I* J2 P t V
if (iedom||document.layers){$ U9 L6 \1 [2 y2 j
with (document){. h9 o: j) D5 U1 j, H6 J5 E9 H) n4 C
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')% Q& L4 |0 @* B8 _
if (iedom){2 t. G" `5 G8 G* g- ]- w4 ]
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')2 |; [& d, S- `9 _2 c
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')6 l% C) E# Q6 g* A8 w* ~
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')" M2 q$ E; D# C" W. I: {" I
write('</div>')
7 n! v* X+ {* {* m$ G: M d}
* b* B& v. F0 ~5 B/ Selse if (document.layers){' g5 W- p$ l4 u% S% W
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')8 X* x% ^/ u& `) q6 n! Y: Y; X' x
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')0 ]+ U% X* z; F0 a" T) O
write('</ilayer>')0 j' a2 L: d+ i
}
; t/ T* c7 n- j% R5 _' I: sdocument.write('</td></table>')% m8 U. P4 L4 `5 `5 T& k5 `" V
}
) g; a* L- K; |3 m. u% {}! u0 _$ f+ |0 Q
</script> |
|