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

|
网页之跑马灯文字特效
//修改宽度( R1 F! O. S2 D$ g0 M; V5 d
var marqueewidth=300+ [0 w6 f- P1 Y4 J( U. m- u4 N
//高度
( Y1 k8 C! U) I: I, M" vvar marqueeheight=25; R2 `1 M3 a( H: D+ H% i# ^
//速度(1-10) D0 V6 [" [% u4 \+ r: r
var marqueespeed=3 ]! I+ k1 T1 Z; [+ Y
//背景颜色! Y2 W0 w r' }/ m, b
var marqueebgcolor="#FFFFFF"1 n6 a) b7 B% X( ` e& l
//是否能暂停 (0=no. 1=yes)?
2 L$ n2 r; d' U- Y. D( m* ovar pauseit=15 x8 Z O! [; |
7 L1 X+ v* N ]" g( [
//修改显示内容
% `% @$ ?* J7 _9 {- vvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'& r; D ~9 A/ x p; v. p
$ _5 h3 g$ b) Y- h- _. W4 h
5 s2 t+ k; y7 W8 A% X////下面不需改变////////////
/ @/ p3 O% n3 S9 T/ _* B5 I
+ {8 X2 c3 [. Mvar copyspeed=marqueespeed
- X3 a# q1 j; q7 J! \, A yvar pausespeed=(pauseit==0)? copyspeed: 02 x0 f) }/ M$ t. J6 q
var iedom=document.all||document.getElementById1 h9 k; z8 s9 m( C; Z
if (iedom)
; P+ J2 }% @1 d+ v1 n+ K! ^3 @) E% Rdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')' \1 N- }; a) C& d
var actualwidth=''. o ]) z( V/ u9 g+ k' l8 n" q
var cross_marquee, ns_marquee$ ~ m0 Z' u4 l Z9 ]( p6 e2 G
4 l% K! F# x7 f8 w! a9 D
function populate(){3 S6 I* ?7 B( \. j" q% t8 y
if (iedom){9 C f% m) |, `: ^) I
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
: ]0 Y, l' ?4 C0 ]+ f7 {4 x) Rcross_marquee.style.left=marqueewidth+8+ F* C6 e/ j" p4 o; d0 u# d& W
cross_marquee.innerHTML=marqueecontent5 U& y) o1 \4 E' Q" z
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth9 T( W5 f3 y2 q2 Y( W) d: G. `
}2 S; o% g% B" `9 f
else if (document.layers){# K7 ?% G9 `# G3 k: _' w. {5 p
ns_marquee=document.ns_marquee.document.ns_marquee2- @% {+ n; y* g
ns_marquee.left=marqueewidth+82 l% B# ?3 Q* x
ns_marquee.document.write(marqueecontent)
/ u5 p4 l" e) Rns_marquee.document.close()
; A6 \% y3 e7 factualwidth=ns_marquee.document.width
# r; q$ ^! b! v8 I' F}
: [# ~8 v# A9 e$ |# Dlefttime=setInterval("scrollmarquee()",20)
: e# j* e5 T- U5 a5 I}2 k; o: j. E2 L7 z9 g
window.onload=populate
* i. D* ~" B: [. Y% D" \. B8 G( D
, u ?+ _: A# V2 \( G, [: |' X0 dfunction scrollmarquee(){
: C9 L+ ^5 X/ Y0 V, t" cif (iedom){
0 m! S8 d: C9 g4 V5 F% v: sif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
& t8 A, H% q6 m% Y! M) u+ h# A8 ~: }cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
; I7 B3 h6 ]0 o8 ^else3 R; z" D$ d8 R+ b- a
cross_marquee.style.left=marqueewidth+8
# W- h7 V' Q: j, c9 \$ @, l1 |0 V6 d; u& A1 @( O
}
$ N4 P/ r4 u6 o' j# M! j" W" s; O- jelse if (document.layers){* V! q" G% D1 L! T
if (ns_marquee.left>(actualwidth*(-1)+8))
- j2 q8 G0 p' v2 e8 t) n+ z( a- Pns_marquee.left-=copyspeed4 j W4 t7 W+ ^/ F6 O
else
, }3 r; ]: Z8 W$ _ns_marquee.left=marqueewidth+8+ ~6 Z0 |" [( p
}
5 e( Q) H1 m6 N ^/ S}
. z5 z, O2 Y7 _. E/ Q# q3 o
. Z' X3 ]3 \. D2 [. z- o- lif (iedom||document.layers){" u8 S( Q, B/ ^$ g
with (document){8 c4 b* q+ s. P p* c
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>') G! K7 h- `4 }! f
if (iedom){ V2 f4 ?1 ?4 x# c
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')& S* P$ Z5 z* ^6 ]6 G+ ?! o
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')5 U* u( N8 n8 z( }) A
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')' v7 E, b9 n: n$ ]1 `4 t" \0 n
write('</div>'): C# J' ?$ v$ u5 s I
}- [9 n5 i' J- B) [
else if (document.layers){; j2 T0 }1 C K
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
6 m2 x4 b* u, t- ~2 S8 _write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')) F9 V2 c& E# v. L7 A
write('</ilayer>')
2 a1 R! n8 ~0 J+ V+ i* G1 }}6 `) z7 y7 T- O! T+ m( C( j
document.write('</td></table>')9 Y9 |% e7 I1 {9 q0 B
} a @6 x* h) Z0 w7 z
} G1 q$ o5 L5 Y
</script> |
|