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

|
网页之跑马灯文字特效
//修改宽度9 M$ H# \1 d; b* ] N
var marqueewidth=300# E9 N' c8 I$ T7 z
//高度
0 t! {% A6 T3 T' c2 ^- y: Cvar marqueeheight=25' p6 W; i) S; r- F. o5 k
//速度(1-10)
( L I: r% R3 d( d3 vvar marqueespeed=33 m$ \2 j# @4 Y) e0 r
//背景颜色
' u5 |' b8 P, E8 M7 t6 U1 N: b9 F3 wvar marqueebgcolor="#FFFFFF"
% M7 Q+ `& Y2 w/ g4 i5 O: n//是否能暂停 (0=no. 1=yes)?
7 F3 K0 x# [. ovar pauseit=14 `, u5 {1 p6 H1 H
0 o) b- {) d; O* r+ }! u( ] I
//修改显示内容
/ E1 X. N: s9 ]5 C) P0 n% h$ Dvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>' Q- m( F$ O2 w5 [1 i H3 q4 A
& D, P3 W# l: I9 H; L8 O' R" v" }) a+ S; Y& i( H2 V/ B
////下面不需改变////////////0 I' N6 |+ _1 Q/ w+ h0 i6 k) Z2 x
* ~2 e3 O. `% [4 n4 O* O5 M
var copyspeed=marqueespeed
1 @; p( g1 u% G. @3 bvar pausespeed=(pauseit==0)? copyspeed: 0
% r |. _* q$ uvar iedom=document.all||document.getElementById
4 C/ e8 _2 |/ E3 X# \; b7 L6 E1 Uif (iedom)
. j" I7 m6 _0 Q$ Q1 H7 {document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
3 o, k0 \1 z8 s( }- O$ ]var actualwidth=''$ D" i9 d7 ? x7 |: a
var cross_marquee, ns_marquee V; A% o& j; L
& E( b1 `0 J! U' U
function populate(){) C4 t" S" {' x' d
if (iedom){
" t0 L, K0 T, v0 g4 ~' rcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
( p* m2 u) h" z4 N1 E2 Lcross_marquee.style.left=marqueewidth+8! _4 H# T6 h9 G0 o5 l' M8 `. D
cross_marquee.innerHTML=marqueecontent
$ w( |7 t. y6 L0 d/ _actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
( g) q1 d0 f1 t2 H y}
4 E, J! |4 Q% s* x( \) _else if (document.layers){9 _4 c4 |0 t4 n: j4 @$ r/ ^; I. W
ns_marquee=document.ns_marquee.document.ns_marquee2
t ]- K6 f' J- }# y" J! A- I; ]ns_marquee.left=marqueewidth+8
- ^" I, F' j' F2 h1 e: U6 B. ]* Mns_marquee.document.write(marqueecontent)
" y) @0 t C, d6 K i1 ], A8 Uns_marquee.document.close()
9 `- _8 m, B# B e# Y7 m8 sactualwidth=ns_marquee.document.width( t3 Z8 e) B; x/ m6 r9 U! C
}/ N7 X y) y% U0 U' T' [/ T/ k
lefttime=setInterval("scrollmarquee()",20)3 A$ A; ]( R2 {$ F8 s ^
}
+ T- ?3 J# u8 S% Wwindow.onload=populate
' w) y! p5 F" w! h+ o) D8 F; B
C# m; L& N9 [! dfunction scrollmarquee(){
) F* P! L" w0 [if (iedom){
4 W7 u6 o) V6 L. ]if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))1 k' l, o( D0 h* c$ Z7 [! h
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
% s9 D, ^/ v2 Lelse. B' F, H5 T) e7 ], L: c1 @
cross_marquee.style.left=marqueewidth+82 C/ d6 E$ k' u
) o" t# C3 @$ N, H) @! ]1 j! a
}
4 r& d; w$ p" K Melse if (document.layers){6 H0 H$ A8 N0 y- H% c2 l. z
if (ns_marquee.left>(actualwidth*(-1)+8))
, Z. H2 w/ s' V; R! Kns_marquee.left-=copyspeed
5 b1 X+ p; k! v. I, y9 `else5 u* z) ~0 W# J* Q8 I( b
ns_marquee.left=marqueewidth+8
# u, M1 k0 ]$ l1 l' N}
9 e" E) J2 n% R9 v5 s! d8 i}0 t) k1 O* ]5 t" G3 R0 ~# S, U
9 x# o$ |$ f, l! jif (iedom||document.layers){0 W( F5 ]$ i0 U0 N; e( b% V
with (document){
; O6 R- K7 a" L6 J; ^8 m+ B9 ldocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
. A. l+ R; r0 _+ bif (iedom){3 C2 S& R- o8 B1 S, w
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
5 S3 E8 n/ N: E% X; ]# mwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
2 A u6 h. y" T% G) I. nwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'): B: L6 B9 F0 D# m( W
write('</div>')! l# N9 ~5 R4 r& L$ T7 l4 c
}* @; ^) T+ a8 \
else if (document.layers){' R8 l& i, \3 v. L
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')5 g- R$ L0 G2 y) U: y
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')4 i$ o( p! w' c4 M. H
write('</ilayer>')* |9 u( P# d( ]8 l0 l0 n l9 @3 O
}. ?6 e9 p4 Z+ ?. j1 l9 P5 x
document.write('</td></table>')
5 c- r. `' g8 Y. [, i0 K7 X}' U* U' ?5 h- m0 T. _
}& H; J* `/ i5 A
</script> |
|