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

|
网页之跑马灯文字特效
//修改宽度
: V( n& M5 ~2 Q, Uvar marqueewidth=300
8 t0 o' p4 O5 f0 T' t//高度5 e3 ~, X& i6 `
var marqueeheight=25
( Q9 A3 R8 Y/ T. f5 A//速度(1-10)1 r" c4 H! I/ p& f; x
var marqueespeed=3) j) K+ u3 A4 c
//背景颜色+ z @4 D0 x7 m ~% x
var marqueebgcolor="#FFFFFF"0 W* ?' N! z6 D; B
//是否能暂停 (0=no. 1=yes)?
* q& k. [- _& p- ^) Yvar pauseit=1
+ i- l% p% u. \6 a- q% K% _$ i" A
; o) X& m4 {! y a0 a, j//修改显示内容
- A8 T# ]. m) D, I7 V% x4 J! w( Pvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>', C6 S1 ^. i; I0 x7 q8 ^5 c
1 y4 b1 ?0 Q3 v( i0 i8 s6 q
6 r/ `! f: y/ @& F+ d////下面不需改变////////////
: f" U& F: i4 m2 h( c+ z$ J1 C; f0 v# p8 W* k
var copyspeed=marqueespeed
; I" N7 d) @. q0 Evar pausespeed=(pauseit==0)? copyspeed: 0# @5 _9 O0 N% S6 y* I6 ^9 j, Z. P4 e
var iedom=document.all||document.getElementById6 L. C; u2 `, u
if (iedom)# Y B5 T6 N) \9 S" x* c/ w! F' C+ {0 j
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')$ F6 R. ]/ m* X- @! q5 u8 P: e- N
var actualwidth='') r) c8 a7 O. V; J U
var cross_marquee, ns_marquee) D- D% r7 |5 b6 x
) a6 M( b) O6 J3 h
function populate(){
; e* N" {: `7 f3 i& F9 Aif (iedom){' A$ P0 z: h# } y. @3 e
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
9 K: P4 [8 b, a) ~+ v* \% j( s: y3 Wcross_marquee.style.left=marqueewidth+8
% r' J6 l: c- ?cross_marquee.innerHTML=marqueecontent
w) }# T( y/ S# }% Zactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
5 g$ e9 B2 p- N* `" V- j- s}
; f" J) a3 T" T7 m; z& ~$ Gelse if (document.layers){
- O. n3 q9 H% J9 n% Sns_marquee=document.ns_marquee.document.ns_marquee2
- J, ]8 y$ C, v6 U# pns_marquee.left=marqueewidth+83 j; p; b3 G# R, o$ ], q
ns_marquee.document.write(marqueecontent)# C& X4 s3 r9 @# H- W" u
ns_marquee.document.close() H0 P' W$ v, t7 y g
actualwidth=ns_marquee.document.width5 D6 ]; Q. \! ?$ R
}8 g$ Q% L4 ?3 Y- j8 E1 x
lefttime=setInterval("scrollmarquee()",20): ~! n+ V( C3 U5 `6 m1 T
}: z6 j$ k3 B5 x3 ^* m1 U
window.onload=populate) Y+ K. a2 t9 x, F2 P
1 B+ c. ?- F' D
function scrollmarquee(){
2 b& ~0 H# K2 I( Nif (iedom){
+ F; R$ Z. N, hif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
# u$ i U- J4 b/ r5 i! G! A7 o) Kcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
( A* d9 h4 N. telse
, I. V2 C/ p. R1 j0 m/ Mcross_marquee.style.left=marqueewidth+8
8 k( H1 {& k# W' Q/ g! c
' f5 `' {$ h" `0 L}; Z" a' A% a. ]" w: Y U3 q Y9 ?1 u
else if (document.layers){
& h& N6 o% _$ @; E; X1 Aif (ns_marquee.left>(actualwidth*(-1)+8))
8 x' H( J6 M' r1 Uns_marquee.left-=copyspeed
! j- e- Y1 C! e1 q- ^1 p) Melse
' z1 n4 a. d, x+ ~! ans_marquee.left=marqueewidth+83 b) J4 R7 O: Y$ k0 o% s, U
}
) J7 U& R8 Y; I* _) U}
4 l0 ?( {3 j. F: f1 X6 i
7 v4 p3 y2 h+ _, I5 kif (iedom||document.layers){% U8 V) x" F5 z4 C! x& K
with (document){
& D+ E& U" F1 r' P/ kdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
/ U# D8 y [1 a; l5 v3 @' xif (iedom){
6 p2 |! N( V; c& G7 zwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')# }' V" T& h1 S" J2 r! Q
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')% Y- n+ P7 N$ Z* g/ C
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
) u. u3 P* K. U; Gwrite('</div>')+ m) O% ]" @2 A8 w9 m) v J [) Y
}
5 t+ [% ]8 H: l) W0 b: _else if (document.layers){1 N/ p3 j" h- W" {+ k/ {* C
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
, T# k) `- ?, ?9 pwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
8 C. W8 r. K, k, c8 Pwrite('</ilayer>')
% n3 q( Q$ j1 U8 i4 R}$ Z4 q4 r x- {( U8 M/ J, \
document.write('</td></table>')3 Y2 g7 M9 J8 O2 {- A
}
! }7 e, R. M3 q( Q* Z}
; F5 n. o3 ~ L</script> |
|