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

|
网页之跑马灯文字特效
//修改宽度
* F4 ^# T* z7 `8 h0 I' m5 Jvar marqueewidth=300
7 G% _" h" j. I# L1 Q' K//高度
2 f o% V. E/ M8 j- P6 V. o- Uvar marqueeheight=25
, ?8 |" u! ?& D/ S' E" {( ^//速度(1-10)
6 R; {* h& W8 z9 J' K! kvar marqueespeed=33 G; C- k; t9 z* q; E( `
//背景颜色& ^' C; D; b: N9 s
var marqueebgcolor="#FFFFFF"4 {8 |1 w. s1 |" i
//是否能暂停 (0=no. 1=yes)?
" P% r; B" a* I: _var pauseit=1# w. o0 z, V6 f- @5 m
; D6 l; Y6 r6 _, a/ W/ A//修改显示内容
0 R- v6 v) W, {3 Tvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
+ {$ X" d, R2 t2 Z- G |1 C2 y% B* x
/ ^) t0 i$ a* }" w2 x////下面不需改变////////////3 k8 T! A; ~, j: c' x$ V2 |* u1 R
3 X* D8 [$ E a ]' ^
var copyspeed=marqueespeed
1 Y J, s. z2 w7 ?9 p$ B5 K5 m8 dvar pausespeed=(pauseit==0)? copyspeed: 0
0 b4 ?) }; P( @3 @' z1 C+ g Q& Evar iedom=document.all||document.getElementById/ b6 L+ f. s6 x9 {
if (iedom)
4 E& M: w R( m3 Ndocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')' H$ ^) j4 O1 l, Z- Y* i; q
var actualwidth=''
3 i5 A8 v6 C+ s5 l# ]" W" b% jvar cross_marquee, ns_marquee" ]8 ^& m* p# A V9 Z Z3 K3 q4 \+ ^
% n8 e3 X' k# ?3 e" gfunction populate(){
- l3 V) A0 e& H) P; M1 \if (iedom){' f$ [3 Q# R5 t0 f7 }. n1 I8 _
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee# C- P9 Y8 u: y1 i
cross_marquee.style.left=marqueewidth+84 i; A. b( ^2 `' z8 `% h
cross_marquee.innerHTML=marqueecontent
1 k& \3 Y( B1 s a- g' tactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth o$ [- M! A3 X+ N6 e
}
+ h8 Q' @9 f$ F# n% S5 U. uelse if (document.layers){5 t& p4 ?2 l t5 Z8 R8 l
ns_marquee=document.ns_marquee.document.ns_marquee25 @+ w: }6 t5 Y
ns_marquee.left=marqueewidth+8; x. C0 U# f. }1 r! L/ Z
ns_marquee.document.write(marqueecontent)2 R9 W4 T3 P* i' ]* m: P+ |% z* G
ns_marquee.document.close()
5 M& h, Y1 v4 c: S' c* X0 K) Tactualwidth=ns_marquee.document.width& O% d! K. S7 e) ?& ^& ^( U
}8 E" p) o* z3 M: E
lefttime=setInterval("scrollmarquee()",20)0 |5 g! l, s3 ] m6 s
}+ G% @3 U0 N% E/ Y' [
window.onload=populate
; a! q; T6 V+ W! t# X' \$ x
) g: k- Y2 B% mfunction scrollmarquee(){
3 C, r' ~( j4 ?8 ^' H7 q" Jif (iedom){! T* l/ q7 ]2 X$ Z) ?
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
$ \9 r' h) G& W y4 X' g& Bcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed3 T: d9 ?' T! D4 K! q7 ~
else
, w1 O4 T/ P: ?# kcross_marquee.style.left=marqueewidth+8; M$ l: U- C7 n
. ^, Y6 b s! w+ A' u. K, a* u}1 n+ b' _, r$ K4 v6 D
else if (document.layers){5 w2 u6 `# ^: O4 l' p+ o3 U
if (ns_marquee.left>(actualwidth*(-1)+8))
# E' m6 w, D& l5 N2 X/ u( ~ns_marquee.left-=copyspeed- ~( z& B' p4 S, k0 O6 | [3 K
else& e& P) q. q B$ M0 S
ns_marquee.left=marqueewidth+8
$ o- ^/ L2 i, K* R6 }; f; |* \! N}8 \4 q0 `1 }* |# A
}) {& X5 z4 m0 L% w6 K0 D$ {( t# i/ y
3 T# F% r6 F; G% i: j& C- B% d
if (iedom||document.layers){
; n* k3 `9 q, @* L9 cwith (document){, R. I$ `1 ?$ V4 q! t' D
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
; [7 a9 q& N/ f; r( D* zif (iedom){
' ?9 C, v; S2 X; Q9 W% Dwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')/ s+ e+ [3 t7 P) r3 n* w
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')+ ~2 c! j% i% E8 i! Z
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'). o* v% w% U8 M6 b$ ]
write('</div>')
# @1 h( i& R/ C; u0 q- ?' N}+ S R- X+ S& [+ R" z7 B
else if (document.layers){
: f* A# Y, ?& A0 J5 @write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
: d h) @5 u( L/ Mwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
, I3 X% V; r4 c1 Owrite('</ilayer>')
( V& L# [/ j' A: h, _}" a$ V# h, {- W% }6 @8 p! q
document.write('</td></table>')2 C9 e/ c) E p: F. G& v) }
}" V6 s1 ~8 i" A9 k, f; a
}" x" l6 B3 F+ Y4 f2 m' y" I2 }
</script> |
|