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

|
网页之跑马灯文字特效
//修改宽度 }; ^$ j0 a/ ]* L) ^
var marqueewidth=3009 S. O+ ^) P. t7 s
//高度
# ?* W g8 K& w/ B2 X. R7 tvar marqueeheight=25/ B7 g( k1 z- b' T
//速度(1-10)# r# p9 D: Q8 ~$ H. w. o/ @# A" }" R
var marqueespeed=3" j1 K8 h* @. ]8 V( w( v" \$ a, h
//背景颜色
9 _" n* I. R1 d* E, m2 c, `var marqueebgcolor="#FFFFFF"" s8 `7 W% `+ C0 X
//是否能暂停 (0=no. 1=yes)?& G1 x0 S9 C/ Y h* C5 [
var pauseit=1
* S3 ?. [5 \; I/ Y6 M* @$ _. b9 H
//修改显示内容* ~- O8 c- i; l( p
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
' C' e5 U2 z$ O
& e! X2 J- [6 A0 a5 u# h- ]1 F" u& J" d
////下面不需改变////////////
- S4 v1 V( r0 Z7 {: d9 k9 d
: P; ^; b9 W6 I( v4 Qvar copyspeed=marqueespeed% f/ _; J+ ~, N% `+ x% ?
var pausespeed=(pauseit==0)? copyspeed: 0! l# v( Z/ K! z6 H5 d2 l( R. l
var iedom=document.all||document.getElementById
% @2 u6 c1 P1 N" i9 ?. K+ ?1 U( }5 lif (iedom)
' [# N' \; b7 O4 u% h6 ^, x, S( jdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
+ x* ~' j) X, B; svar actualwidth=''
- u0 `1 b* z' Bvar cross_marquee, ns_marquee
0 T% p7 r) d4 N+ o& v$ S
; m: P7 I5 f5 e) A l& ?function populate(){. X! B; d6 R, @% i7 @
if (iedom){3 ]) U/ d) p7 ^2 h4 y- _/ f6 z* L! u5 R
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee7 A& b, @: z C
cross_marquee.style.left=marqueewidth+8& n' n6 p5 L0 r9 o$ Z
cross_marquee.innerHTML=marqueecontent
+ C: F9 L2 Q1 d1 T! z# Y& X: [2 Zactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth) {5 m1 V6 |8 H$ K0 H
}
( i3 ^" M2 F; ]# g& y( j9 r9 X. ~else if (document.layers){3 e: _# e* H" S1 v" k: d3 k
ns_marquee=document.ns_marquee.document.ns_marquee26 X& V7 p: Z) _
ns_marquee.left=marqueewidth+8( e5 i8 t* c% i
ns_marquee.document.write(marqueecontent)
" z! U0 g4 y) n. D9 ]ns_marquee.document.close()
! \0 `$ [4 W& H8 A; N' `& Nactualwidth=ns_marquee.document.width/ `$ u# l9 m. a! N9 {2 O P
}& E7 S: c) @# U6 K, b
lefttime=setInterval("scrollmarquee()",20): d% y* B+ h# S+ _' y
}
* W9 I- s8 h2 ]6 c( Z* _window.onload=populate& p6 ` E* Y( k% c3 t/ _* X4 ?
3 [# G O# E' I6 w* j6 H, vfunction scrollmarquee(){
, M4 \/ b, ?2 C8 G, h {0 Kif (iedom){
: G+ ? j. l& h, u! qif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))4 T& p$ M1 k/ L I
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed8 c0 |' i5 R0 \3 D
else3 C# y8 S7 P: c7 z6 k7 e) P& l5 c
cross_marquee.style.left=marqueewidth+8
3 Q) y% e! T& _- a: ?1 N( S9 q, F% s
}& R% J3 ~" |6 V. M% G/ q3 _
else if (document.layers){0 R1 p3 Y9 ^5 j
if (ns_marquee.left>(actualwidth*(-1)+8))
0 W; t, R$ ]8 O+ c. jns_marquee.left-=copyspeed/ u* E7 A' U8 V2 \
else; H) g; S D7 }4 t3 f
ns_marquee.left=marqueewidth+8$ e! ~, S& k& s' V6 k
}
o% _6 T4 A. P7 k+ T}" r8 l3 a1 U; `5 q9 Y5 G
' d: w7 m) K7 U9 Vif (iedom||document.layers){
1 Z8 U) ?6 Z0 c2 N3 W8 n$ q; Twith (document){5 n5 W5 f- L8 G# F1 m% Q/ C
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'); f0 q+ [+ S$ z" Q) H J, I
if (iedom){7 @; X& ~3 J' @6 ]& z
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')' G$ O( J) t; P3 |. Z7 u: r
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">'). r' F; E$ g7 T9 U' I7 j' l; P/ d
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
9 b! a0 U" B5 F& f7 t; H5 |write('</div>')2 O: G! X2 L( { Z; U D
}4 |2 f" d. d& ~' }. \7 W* `, `
else if (document.layers){ i! z- _" C1 ~0 g" r3 b/ F
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'). l {+ H8 q! [! X. Y$ u, Q
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
- |7 ~& m- e; Q- pwrite('</ilayer>')/ j) j; S! N$ v1 r0 l
}# Q# C4 \& l& A# y% L6 t* G) _
document.write('</td></table>')0 G8 } g5 a6 h& y
}
1 u% g( ~' T1 f' R$ v}
1 g: Z% ] }# r! \/ W7 E</script> |
|