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

|
网页之跑马灯文字特效
//修改宽度% \" Z$ x+ A# d1 k; l" `' \
var marqueewidth=300
, M0 Q4 U" C: t* N! |' F//高度
5 S* H) g# i2 p0 d7 `1 |% i4 |var marqueeheight=25
1 P* N {. m9 n F5 w r# a//速度(1-10)# B0 J) t+ b( n! B8 Q, L6 t! Y
var marqueespeed=3
7 L% |* p2 l8 H8 ?' D0 M//背景颜色/ u$ ~7 t8 M* n: ~' `
var marqueebgcolor="#FFFFFF"
) X- o2 ?) A. H//是否能暂停 (0=no. 1=yes)?( \& d) h1 Z2 }' Y" @7 v
var pauseit=1
9 G- k& K: p* r3 r
9 W F, O( h8 Y6 y0 G6 B e0 p! G2 O//修改显示内容: b% @1 _- g% F& Z: w# u
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'+ q" u% L( v. g/ K0 A# I! n- [
4 d8 J4 \' z1 i! Z7 p0 ]
9 D1 {: ^6 m: A////下面不需改变////////////
; t9 |! t. s: P3 j2 o% A: U! y+ F1 Q+ W4 F: y4 C
var copyspeed=marqueespeed! ?7 F' m4 c! U' ?9 X/ W: p) p
var pausespeed=(pauseit==0)? copyspeed: 05 ]5 `$ ~8 p" S- h0 J
var iedom=document.all||document.getElementById
1 j/ T$ o" P& Yif (iedom)
* k; z' o! N2 N. ?document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
; f; Y7 x" A7 X6 A# b) lvar actualwidth=''. e1 V$ C+ `- b& \" N
var cross_marquee, ns_marquee6 \' I K4 b& P: U9 b' X% k
* m5 D( k% Y0 I
function populate(){
# u* L( T1 H" |& Aif (iedom){( e( ^) p7 \+ a! v! O3 p2 @
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee4 b' W% n% ^( V# e' V" N
cross_marquee.style.left=marqueewidth+8! M! t1 [/ n8 C- B3 |4 }
cross_marquee.innerHTML=marqueecontent
3 {& ], S: c( V# o: R0 Tactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth% d. o: \6 F4 [! s
}0 }1 a7 U/ W+ u5 ~/ r$ {
else if (document.layers){
" `( {5 _" W6 k5 H5 b6 k5 D `ns_marquee=document.ns_marquee.document.ns_marquee2! i" _+ C/ W4 ]5 }
ns_marquee.left=marqueewidth+8
4 s- F: m9 _0 j; d& A5 X6 uns_marquee.document.write(marqueecontent)
7 U& }; \' D8 H# T( a/ K: tns_marquee.document.close()# g s3 y% ^' M' ?
actualwidth=ns_marquee.document.width# ^6 @. G% ~) D
}) o1 I7 U: L, t' @
lefttime=setInterval("scrollmarquee()",20)
0 |8 y4 |" e5 v" l! J7 r}: p2 Y2 N3 e! B; _; r6 ^" E
window.onload=populate
5 l- S2 R7 ]$ f5 [
8 ^ s H0 k, i4 I! z* |% o& E jfunction scrollmarquee(){# [; {6 E# L: e
if (iedom){, ~' j i% {0 B- ?3 C
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
5 j5 p! t# I& k& U2 J4 Bcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
+ k* X8 O( V# c# f; {, felse/ K4 g/ x" q2 W- o" p
cross_marquee.style.left=marqueewidth+82 {: t! [% e0 ]# U1 P
0 |: ~! G t2 N" k; a4 P1 v% @
} o w; j+ T) U* r
else if (document.layers){2 ]' r5 R4 Z8 Y2 X: C" W
if (ns_marquee.left>(actualwidth*(-1)+8))/ D y. A1 Y1 g
ns_marquee.left-=copyspeed5 Q# E _$ q% i( T" x* B+ K
else P$ |1 {1 `3 ?: G0 t) A
ns_marquee.left=marqueewidth+89 J4 }$ r6 k: R+ Q
}! O2 l+ B. d2 h; Y) _& Z
} c1 e7 k& k7 S, B
5 v) Z1 a. b; h7 G7 ^: r: g! @6 Y) S
if (iedom||document.layers){
5 D4 h) B! u! r9 P; U/ cwith (document){
6 k2 r, E0 z' V5 gdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')0 w8 w4 [" W4 i6 {. ^) L/ [5 u. |
if (iedom){
7 N" O0 Y4 @ S' uwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
% F: q( s9 p5 T$ f7 awrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
1 k) h F% [" pwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
/ i( ~2 y+ {- L8 c# F8 hwrite('</div>')
+ Y0 e5 S C% R( E}
! I8 c2 [/ l4 G4 X4 E! Felse if (document.layers){: F/ n. ~1 o8 W, d/ \4 a# w: E
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
; P: G7 u# t* X+ awrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
* W" |9 u+ _4 H% v7 `4 Zwrite('</ilayer>')
) p' q* | ~% k: Y5 `) N3 H}$ g. W+ }) f. h2 `& m
document.write('</td></table>') E6 c2 i1 D4 Q8 a% J- R
}7 o2 Q g! B8 F6 {' n/ \
}3 C5 e; g5 d) h6 a: ?5 p# |# N1 G
</script> |
|