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

|
网页之跑马灯文字特效
//修改宽度5 R, o: z! H0 C0 a& I
var marqueewidth=300
; A& c: d) r* F//高度
; c/ C* o' t( b, wvar marqueeheight=25
d# f; T$ ~, h//速度(1-10)
3 h- l3 @2 B/ [var marqueespeed=3 K0 m: p Q! Q6 V
//背景颜色- e5 O' q. F; e8 D Q
var marqueebgcolor="#FFFFFF"9 B" v9 V8 W2 N4 q U
//是否能暂停 (0=no. 1=yes)?
2 @" Q3 `( ~' n7 l0 N9 }var pauseit=10 j* j7 _: G/ B: T8 M% e. a$ d! n
; G; ]' _, A+ Q8 y' f4 z7 Y//修改显示内容
% V0 q" D: r* M z! A' ivar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>' Y" A/ v6 ^7 g5 L! N
+ l# G9 D/ ^& w* I+ ~
' p. h8 G6 y. q' M////下面不需改变////////////
5 s; v, v+ ]4 H7 \, n/ P8 r6 n# e% p* |
var copyspeed=marqueespeed
; G' v. d) w! t. R8 Dvar pausespeed=(pauseit==0)? copyspeed: 0
+ C0 A* s7 K9 S* jvar iedom=document.all||document.getElementById9 T0 d1 R" o+ a8 B2 N1 c
if (iedom)' C0 S! g8 b- D; e9 x2 g) F' z. y
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
" e0 A2 g, B7 Tvar actualwidth=''* D" R6 J3 L" f# J$ {
var cross_marquee, ns_marquee
* j8 }* U+ V% ^3 }! z, T% m) n4 p
) Z# I$ h$ }, N+ \1 E) V" Yfunction populate(){# o r( ?( P8 W. a
if (iedom){
9 l$ u5 N+ p% h8 \1 C4 I1 q7 Zcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee q+ a4 r) F% t6 d0 N8 y* u% D& g. h
cross_marquee.style.left=marqueewidth+8
4 S" v# v- P* }9 Pcross_marquee.innerHTML=marqueecontent- @5 z; N1 [, ~9 ?* w0 @+ o6 s7 d+ R
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth* I$ b, Z- M+ _) W( o1 k
}+ o: S2 Z, v9 K a' N1 @! j; x/ M
else if (document.layers){
& w# q( \8 @$ q! ~9 ans_marquee=document.ns_marquee.document.ns_marquee2, E1 p) [) |- t) Y, p0 R
ns_marquee.left=marqueewidth+81 Q+ T$ Y B, t5 f: \* ]
ns_marquee.document.write(marqueecontent)
+ J9 d5 C: k# V3 u- S# r0 \7 N' Lns_marquee.document.close()1 v1 u7 }' T( ^3 q7 E
actualwidth=ns_marquee.document.width+ G5 G# t+ H- g) |7 l3 u4 Y0 t
}
3 N6 F$ D L3 s6 U: Ilefttime=setInterval("scrollmarquee()",20)
# V: o6 p- W# k}- F7 l6 E4 H4 a) q
window.onload=populate& G3 c+ |9 b1 S
: v/ e, p$ k+ ]: H+ X! Bfunction scrollmarquee(){2 V, w% W! x \+ D- |! ^
if (iedom){
% ]& {2 S% T; Sif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
8 m6 }& M* J) o9 scross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
% R9 l: s8 D4 E- }! Kelse3 l; q! u d# a
cross_marquee.style.left=marqueewidth+8
3 G# `6 y5 L# R# v+ h
* J' H5 ]5 E5 O! J! K" s/ @}
$ Y2 q L( w8 ?0 T$ Oelse if (document.layers){
/ c, j1 ?8 h' C0 [6 Oif (ns_marquee.left>(actualwidth*(-1)+8))& I0 q$ d, _7 `- r0 S
ns_marquee.left-=copyspeed! M* [6 R/ _3 n- S" }
else& }" F9 c; \" _7 @, R& K7 r% l
ns_marquee.left=marqueewidth+80 Y1 X0 a( d7 W9 n% D7 X$ [: j+ M
}
# I$ ]8 z0 Q# Q. T* S* d8 n( P/ [}: e* e' {8 V8 w( |. }7 {- R, `
: m7 |7 B' h. q* }8 F
if (iedom||document.layers){
, N4 Z( ^! G' _with (document){/ r; O- W( a4 t0 F2 R6 q' C
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
7 t3 d& f: d; b( {if (iedom){
; X% C r: I9 }write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')5 j4 U/ a; f y# e: t" i1 F& ^
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
' R1 N. y# T$ d; j1 N1 kwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')# g% V, }5 m& R8 |
write('</div>')
3 V2 d3 ^5 \ E- y# ]+ u}- K4 \, l. K* c2 X. }
else if (document.layers){
3 z' d- u/ _9 D. Q3 swrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')0 h. E8 s+ X6 k$ f' _& p* j) b
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')1 e1 f' C& [; L1 I
write('</ilayer>')0 D# o! n1 |. { C
}# D) b4 J' U2 g( I3 G* \/ ]4 O
document.write('</td></table>')
8 o, Z G3 u; h: _6 m* A}: r4 J. [% V# B4 B) H9 Y
}
8 b7 a) _0 @4 q; _. o& `</script> |
|