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

|
网页之跑马灯文字特效
//修改宽度& V' ]: M" n! M W% |5 l) w
var marqueewidth=300
- z2 O) V+ @ v) `8 [//高度
* ?! W/ G/ X; l$ h& R* B$ Tvar marqueeheight=25
$ g& l! Q& w3 i//速度(1-10)
% l: x7 H* B8 lvar marqueespeed=3
& X% ?8 K$ q- E) o, q2 b( B& a: `//背景颜色
8 d: j" C% x7 w" I/ |# f- y4 J6 ivar marqueebgcolor="#FFFFFF"
# g3 z7 Z. W$ S' M0 V//是否能暂停 (0=no. 1=yes)?
: g" d X+ A4 J2 A( V q o8 `var pauseit=1
5 p) [# x$ n" v, T' S9 ~) ?. u
5 F. c* h6 t3 n) C K//修改显示内容
% i3 I0 m3 m. h! ovar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
. ?6 i' k2 V* z5 {
. T1 i# x' Q5 D- |( R
) {/ _! L3 g' Z, i////下面不需改变////////////
3 e5 r. \/ f- }3 \2 W
0 G# b: a1 X% fvar copyspeed=marqueespeed
+ H! E9 e4 F, {9 H2 pvar pausespeed=(pauseit==0)? copyspeed: 0
+ E* R$ c: O8 J" [var iedom=document.all||document.getElementById- y7 h8 ^5 y2 m1 ?
if (iedom)
" p2 O5 u3 ?' k+ Y$ @document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
3 W2 i# l. j: `/ @var actualwidth=''
2 @) s! P* L e- Y) F, O2 b5 |9 uvar cross_marquee, ns_marquee- O9 L: s6 h1 j1 l3 }" @
$ Z# ~. P9 S. F1 Z$ \
function populate(){2 I U# K3 w- ^, V! Z3 X
if (iedom){
6 m; r$ w0 n( dcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee8 X9 D0 [4 k; y) [ s& K) O$ p6 R' o
cross_marquee.style.left=marqueewidth+8
3 R# U6 E' N2 W% M0 \. vcross_marquee.innerHTML=marqueecontent
6 s, q- M$ J, A* U" M, _* {- f8 N: \actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth: F8 ~5 T* c/ Z1 X4 O) B6 `0 o
}$ @2 I/ W" c- l, Q2 e! q
else if (document.layers){
' O" t% O& @) V/ c7 Q7 Ens_marquee=document.ns_marquee.document.ns_marquee28 [) E! T8 [- f
ns_marquee.left=marqueewidth+8
0 ]0 S$ N. ^: I: _# ans_marquee.document.write(marqueecontent)
, B$ ^5 S( I5 R0 lns_marquee.document.close()
2 H: Q7 y; i. u7 [, vactualwidth=ns_marquee.document.width
- R; @( `3 I& ]6 T3 E2 h V}
0 u7 v2 z+ h+ b' Y! I( _& o. E. xlefttime=setInterval("scrollmarquee()",20)
; `) s7 Y1 l2 Q& P: M; _ }}9 M; ^$ m4 o! W
window.onload=populate
8 D, u2 N5 v( N _0 d+ n3 l$ p: I' Q! {) g( u4 M+ J. u' h: \
function scrollmarquee(){
5 N( b. @% _! z4 qif (iedom){8 C$ @: A; g. I( C
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
) G2 |$ F1 U0 C. bcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
6 t4 O1 c2 ? d' X5 P7 Gelse
0 Y* X8 p; {3 s w8 \. D0 U! Across_marquee.style.left=marqueewidth+8
+ E+ \1 M* L" O5 j& J2 x* m- i$ c: e$ D3 `
}* {7 z8 ?) U7 R( }7 p
else if (document.layers){
7 k" k' z0 [2 n) {) Yif (ns_marquee.left>(actualwidth*(-1)+8))
6 C) Y, ^5 v* cns_marquee.left-=copyspeed
% j" r% Z# P: P3 Welse
% N( |) w' D4 @ w/ f( Vns_marquee.left=marqueewidth+8
! d/ ]/ E. }" ?/ x1 k7 z9 I}* c- N1 f) ~1 {% d+ K
}& d8 W. Q( w) b! Q: {1 i
0 {0 ~$ t8 ?9 X% H% F" x* H
if (iedom||document.layers){" D- C( f: t3 P6 F5 w+ c0 }1 e
with (document){
- ~; z: l) a! B, _document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
1 e, s& `! p! a' Y1 yif (iedom){
$ e3 l; |1 g# @4 x6 y! F5 Ywrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
- x* y, _" w- Z4 Q6 Swrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
/ I8 r$ B5 L' T7 B$ F$ y1 Q6 E1 lwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'). o1 {7 o* H* Z: L3 y
write('</div>')* d% j& g& \! L
}
: w5 O3 G* G( } V9 x1 }4 Delse if (document.layers){
4 U' F$ q. q$ w& J9 {( ~6 y% awrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')/ v5 r. z W- i) i7 v% a0 b; s
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
1 j0 `9 F. s/ w$ K1 C4 U5 v! x$ p7 wwrite('</ilayer>')
1 K$ D6 A8 T+ r$ \% c' h3 d}
9 m; [5 o4 d0 S: Ndocument.write('</td></table>')
. M' Y2 G- S) |* D% Y7 w0 Y}
8 S2 R8 p7 u9 u( J9 t2 s}) l" u, y2 |6 h2 v; t* U; L+ Z
</script> |
|