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

|
网页之跑马灯文字特效
//修改宽度
2 ~. j0 e! i6 G# ?9 H5 cvar marqueewidth=300
4 j- z: [9 e& k( {( F- M1 G//高度
$ [3 V2 V1 [0 f. O9 r$ Svar marqueeheight=25
4 S9 a4 f( B8 O% s t, w5 M//速度(1-10)
5 S2 v( I3 x2 a, D, Y% L6 u' fvar marqueespeed=3
# S5 s H1 p9 q; w//背景颜色$ H: K/ x9 c N
var marqueebgcolor="#FFFFFF"
! q; h3 C6 p& u: v5 U8 ]) S$ w//是否能暂停 (0=no. 1=yes)?
: X" _ ^* } v; X4 {# Dvar pauseit=1. Q( z# N/ [) D" p
/ k& ~5 a) {2 `, m' G4 V
//修改显示内容, a Z$ n1 h! d1 i. n* T$ U
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'& {4 E8 Y$ a; e1 }, ]8 U
+ e( A$ F1 x4 w. O: I0 K. a
: c5 U$ x4 p' ]: I0 _/ E6 [" m3 v
////下面不需改变////////////
0 o$ g+ j+ L4 ?; W, R2 _ G: u
8 M! S% w: }7 r$ H) {8 zvar copyspeed=marqueespeed# _. [* k" Z# Y
var pausespeed=(pauseit==0)? copyspeed: 0. {2 K7 Y5 O3 Z9 W
var iedom=document.all||document.getElementById. F3 x4 o" V8 h
if (iedom)
1 g; c$ }& z" Q' K/ Adocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
' U: w) g" E5 [4 hvar actualwidth=''
' W% @1 h1 K9 i& Q" ^var cross_marquee, ns_marquee" s7 h6 B! R7 t8 a) \. k# T5 o$ F
' F; W1 z1 G1 P Y( @function populate(){
1 K& E" W: R* o( n8 l! G; n0 ~4 Bif (iedom){7 o$ w3 k$ A4 i' U& F3 v
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
7 F# L% R7 {' ^5 \% `2 s# ]8 Dcross_marquee.style.left=marqueewidth+8+ W0 A( O- f9 K; _2 y" q- G0 a
cross_marquee.innerHTML=marqueecontent; X3 P( W# n0 h* m- e
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
' x7 L' y; L |- L/ G% l* F}7 [5 s. P3 D/ o3 H
else if (document.layers){5 q7 z u8 l; T2 L2 Y4 Z: z+ f* p
ns_marquee=document.ns_marquee.document.ns_marquee2, e+ c8 H9 P3 ~2 o
ns_marquee.left=marqueewidth+8- y' E' u* F/ T! n% j/ `
ns_marquee.document.write(marqueecontent)
0 C; m/ \. V" h2 |; B2 cns_marquee.document.close()
5 s6 S, M W6 [0 Z% c- w" _actualwidth=ns_marquee.document.width9 [% q1 h; R# Q2 a, J0 r) r
}
. i! y& W& b d3 J# n) \" g2 h& _. Blefttime=setInterval("scrollmarquee()",20)
4 P! { d! n$ J}+ N' R% Z6 o% e, e& a1 B1 P9 }9 o* @
window.onload=populate
/ n" |) O# U9 r% L' k- C R& Q2 m& z: P, J, g" J! D8 i2 k
function scrollmarquee(){
) f9 Z& N: p" L0 K2 G" J$ J* c8 [* d7 vif (iedom){
- y1 B3 A4 y9 J, } |if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
1 t+ }$ S4 u6 o! Bcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed' Q6 a [* y$ ~2 h" `0 {& B
else
; d3 p8 N$ @; R' W/ P4 [cross_marquee.style.left=marqueewidth+8
. H, D( P5 p8 R! Z5 \; D* }( A7 S0 i. N9 ^# K
}4 B' W* q& Q6 Q, E
else if (document.layers){/ A0 d u- V. k0 U* y" J
if (ns_marquee.left>(actualwidth*(-1)+8))( t) S2 c2 z! I
ns_marquee.left-=copyspeed, v( E+ K+ L$ q$ \2 E
else( o0 t6 x! \" a' ]4 N6 t* D
ns_marquee.left=marqueewidth+87 _) D3 f, M2 m* y Q
}) d$ R0 B6 T8 x- A/ @
}: s& Q. A& `* i" R
' p" G% z' O7 H4 rif (iedom||document.layers){; q! ?& C6 T0 Y7 C" I
with (document){
/ j3 ~: M) g! D, y1 L; Mdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
! E6 J# T2 V: \; U2 _/ }if (iedom){ F' {- s$ V4 Y( Z+ n% O( e1 w0 G) c
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')8 z: O; v/ L- a l$ @( ~
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
7 y1 g: R3 e2 x$ u1 X( \2 j! [write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
3 t0 e! l7 {4 H4 Z# f, q& E! pwrite('</div>')/ p1 V4 V+ y8 r( `. u
}# W. i& t4 a8 W# \+ i
else if (document.layers){
7 }$ H! p+ ]! K1 Awrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
5 z( f J9 b6 Zwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
7 W: O; m0 Z/ e/ ]write('</ilayer>')
% w% y* j, d! K$ x}1 q! a/ h6 k) u( f! ]- _
document.write('</td></table>')
( o- ~9 t6 Y: B& I( \}& ^! r3 h5 j. Y, u' a2 x
}5 |4 w" J4 }5 P
</script> |
|