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

|
网页之跑马灯文字特效
//修改宽度' r0 ] `; b' @' [- ]
var marqueewidth=300
3 r- l8 t7 a8 A//高度) k2 S$ ]/ E9 a& N, u
var marqueeheight=25% k1 I% K- z$ a
//速度(1-10)3 Y# J8 r6 E) y# V/ R% G
var marqueespeed=3
$ R) N: S1 ?7 K* F& S//背景颜色' |" E% m9 m6 J$ @/ n
var marqueebgcolor="#FFFFFF"; ~& O( U9 \. z* e2 w, V X
//是否能暂停 (0=no. 1=yes)?
' U/ u3 c0 U6 H% I1 avar pauseit=1
R( I: N0 n& W! ?) r
+ ~9 H# a( [/ {5 J r//修改显示内容2 x4 l& h0 j3 n. e/ K
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'' K' N; K$ o2 I6 G
' e+ I$ q4 b) L- ^0 j Z* x' `
* q' u. T% J# F. ~. s! V////下面不需改变////////////
- r6 g' }9 X( S q3 C
o. E$ A4 f: z8 Ovar copyspeed=marqueespeed; |3 j9 i/ P: X) {( U. b
var pausespeed=(pauseit==0)? copyspeed: 05 k' y& i( w/ Q1 T/ i+ M
var iedom=document.all||document.getElementById
9 W7 n' K: j9 D8 g5 e& eif (iedom)4 J' M* K' h; N" ~" |# \
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
# [* A% M. ~- N3 qvar actualwidth=''# r( @/ n. q$ m5 G0 ~
var cross_marquee, ns_marquee
" n. h8 t9 p! P) ?1 _
0 S7 g0 N$ t6 ~3 nfunction populate(){/ z2 D0 F3 E# G: ^: J. m$ i) {
if (iedom){
) F; W, T' B5 O8 i8 |' ]6 i, o4 Ncross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee# H* g8 r6 t/ u, G) d5 G
cross_marquee.style.left=marqueewidth+8; j* j! |# `' H( w7 q
cross_marquee.innerHTML=marqueecontent
% x& d1 u7 w! m/ h) Lactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth& r3 O# m7 ?; Q" E, O% I
}
( f" h* w' |) ?; S, A2 l3 ~% xelse if (document.layers){$ y4 ^6 c/ t+ i, }. C
ns_marquee=document.ns_marquee.document.ns_marquee2
0 ^3 K9 Q( Z! ?- J( Rns_marquee.left=marqueewidth+8
% V; Z$ |6 L! a' W* x9 h+ ens_marquee.document.write(marqueecontent)! l2 g6 Y7 N$ D# U
ns_marquee.document.close()
3 S/ v R. d; Uactualwidth=ns_marquee.document.width8 \% J) d' \% k
}
: Z3 d# j) |0 y# p! Blefttime=setInterval("scrollmarquee()",20)" s$ c! o% @+ B3 J
}+ J6 z* M1 d0 l2 g# o' z
window.onload=populate4 o4 v' z6 ^: }1 Z2 N
) h' I) [! C* v# j+ q4 ]2 {7 }function scrollmarquee(){
* x) ]3 `" N5 a4 eif (iedom){
; C& \* z: F6 xif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))2 Z; C- o1 z# H5 ~" O( I( J
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
$ e/ ?& S8 Z* |else
: b' Y7 G; a+ q% h( k. Ycross_marquee.style.left=marqueewidth+8
& H P- b3 F, e( l1 G( _% c' B2 e+ _6 {
}$ ]6 c! k% ~: I7 F( ^# H% q; k9 V
else if (document.layers){
) `7 `, ?7 }5 qif (ns_marquee.left>(actualwidth*(-1)+8))
) c8 A' T* r2 g0 K1 w8 }ns_marquee.left-=copyspeed
; R' Y& n4 X3 V$ E2 i) U) Celse
9 X4 i; R+ Q7 Y; gns_marquee.left=marqueewidth+8
& h6 U) R2 r2 P% h' y}* B2 i7 ?7 y, [% K9 d
}# j+ L; V" R" h$ ]* S8 U$ ]1 M3 E0 k! ~- y5 s
# B7 n5 v7 u% i: x0 @
if (iedom||document.layers){
2 K# m) ]. z/ Y& \with (document){
8 R, n5 E8 l7 e+ x. k* P2 Ndocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
- q# V" i% `1 W/ v; rif (iedom){9 P$ j& Z" X3 g4 s5 j `4 M. |
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')6 X# w5 g8 Q% b1 X" f5 s
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')% {6 @$ `+ G1 ~: N% {+ o& v, _
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')" H% ~. o; O( R8 K5 Q
write('</div>')
; N# Q/ K0 ^* O# f}
5 m* l) p: ^+ `% u8 k I- zelse if (document.layers){
: z3 Y' h" F. C! nwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'), K7 G7 W+ |( b+ @* r; a+ _+ b; b
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
# ^# S' W( {2 O/ b! ~0 ^* Vwrite('</ilayer>')" z+ R/ i- \$ p, ^6 [5 |6 [2 i
}
) z9 N9 \0 A6 ~1 l; Hdocument.write('</td></table>')! D4 E1 P" s5 i. G" p
}) x: R* L$ \2 |! [8 `
}! V A" v' b1 H0 X5 a
</script> |
|