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

|
网页之跑马灯文字特效
//修改宽度) G' s- F+ B" N/ r( M% A a( ?
var marqueewidth=300
) Y! v& l, f. {' x. a* j//高度
$ _4 d' }$ _! kvar marqueeheight=250 b2 S- y& k- u! H/ b) W
//速度(1-10)
- n W0 k; f1 H$ uvar marqueespeed=3
( l9 A4 u0 [( l1 {2 C" A; {//背景颜色 X9 x- F: @6 W2 w# O, |" v4 J9 B
var marqueebgcolor="#FFFFFF"
$ Z; e$ t$ P( S& I: Z5 U3 }8 V$ l//是否能暂停 (0=no. 1=yes)?, B, _9 s, I3 }: }, B
var pauseit=1! ]$ z' b7 Y3 _# `9 R6 t* M
- a0 _5 t2 f- o/ h! o+ G; B//修改显示内容
/ V% j2 }' E9 |& t+ avar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'- O w9 R1 m3 ^
5 {4 c/ v3 r# I! u, {8 ^1 ~
N" s% y$ |0 J( C B" M A& K////下面不需改变////////////
8 ^. j$ l" l* r1 f5 N/ O
$ z$ i a8 I/ U7 i1 yvar copyspeed=marqueespeed
0 N1 P2 W% b$ t( N. i7 _8 Vvar pausespeed=(pauseit==0)? copyspeed: 0
2 q3 o8 ^9 _5 p: R+ ~: [var iedom=document.all||document.getElementById
3 w# g. s: U8 j& Lif (iedom); q" J5 F8 i" L
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
% H/ b) r* P( `$ O2 tvar actualwidth=''& @) i! \# f3 o; w
var cross_marquee, ns_marquee
0 ^2 R# p( g5 v e f! t0 B5 c, G0 W+ M" [
function populate(){
, k' @2 f" f1 o( g- rif (iedom){
+ a9 r, t+ K) D: C% c* k& b/ Mcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee0 b0 w* d( [* o# s3 a
cross_marquee.style.left=marqueewidth+86 N$ O! a$ }$ {% m- ]; @
cross_marquee.innerHTML=marqueecontent0 J0 t8 p4 B* ~; K( T, z
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth' d' o1 s5 s N3 f' p; J- c
}
Q0 ^9 m3 b, N+ y4 C6 b$ X) Melse if (document.layers){
7 B+ C- L! O) ]- \ns_marquee=document.ns_marquee.document.ns_marquee21 G# q" y& o- s9 v- H
ns_marquee.left=marqueewidth+8
4 ]) d$ L4 \5 k0 ?! f% `, o$ y' s1 Xns_marquee.document.write(marqueecontent)
' L/ l, h# w, _ sns_marquee.document.close()9 i+ R3 A$ x1 s! Q+ X
actualwidth=ns_marquee.document.width
, ~3 p% X0 i. _1 F}
% e6 X6 w1 I( O$ Zlefttime=setInterval("scrollmarquee()",20)
' f* m: g. U) d) {( E! C}) o( L/ ]! N# c I# E" Z
window.onload=populate0 |- e6 t6 ~, c( f8 t
( T/ B" s# J3 `: A1 I6 t3 hfunction scrollmarquee(){9 C E: q% s% J
if (iedom){1 s5 [ g5 Y' T, b5 r S9 |3 P. z- K I
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))- S8 E' V' C* ~0 O; X
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
* n. V- }# I8 \2 Q" Gelse
" V" i- b$ U9 }# `cross_marquee.style.left=marqueewidth+8
- f* g9 b( b0 U9 h# A, \/ ?/ {0 h" \9 ~! l9 [7 S
}; e0 D- l+ ~+ S; {( y
else if (document.layers){' [$ s2 b! X& u2 {" d
if (ns_marquee.left>(actualwidth*(-1)+8))* c3 k9 w c4 o3 V' Q
ns_marquee.left-=copyspeed
- `7 p- g! x$ S6 Q8 @9 ^5 relse! Q" b: p# j3 w9 n2 s
ns_marquee.left=marqueewidth+8
& r$ R( G& v. W; s Q% J7 ?}" T1 w) f6 Z- ]' J% y
}
" j) T2 t, _$ y6 @% ]% r: Z& l5 i% [
, H* ~! l1 z; {( e5 Q% Oif (iedom||document.layers){7 l4 ]! A5 K7 z0 e# o' [1 W" G( B
with (document){
& h- Q9 s# F2 p" J4 zdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')2 A x5 g& b! ^( J1 {& N! l% u
if (iedom){ }6 h% G# F; ?5 j
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
9 {/ r) M% J: n, C2 _. J! Twrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
! b- s0 D+ S: ?write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
+ D0 o" R2 M2 `7 L8 v% O- o5 \6 Rwrite('</div>')
' D) t6 [5 A6 m5 F% ]" j. `}1 ^4 J- N" N% }# R) |0 n8 U
else if (document.layers){
1 i( ^- Y7 @0 Z& |: P2 p$ H% twrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
' D3 y2 m3 z: C2 y" g ^write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>') ?9 U- X7 }: N5 A" |8 g9 b3 a2 `
write('</ilayer>')
& M' h( S, m; K; V+ S}) d+ L0 n! n2 V8 k$ z& J
document.write('</td></table>')
5 W' S% K( ~( D7 q% M}
, W$ A8 f# ^- \6 ~}8 G7 M1 j9 Z$ |
</script> |
|