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

|
网页之跑马灯文字特效
//修改宽度0 |, g; q! U+ ~7 P! a
var marqueewidth=300) K1 d) k; Q" I% {
//高度
O! c# K0 W6 H- {) B( \var marqueeheight=25
6 J( k+ G) a) o$ B0 I2 `//速度(1-10). O/ Z# h* K; j
var marqueespeed=34 e3 {: \8 s* U' x) }; |$ _ n5 I
//背景颜色
$ R1 p7 X V4 q% Qvar marqueebgcolor="#FFFFFF"* n" ?1 b' f0 X9 e w
//是否能暂停 (0=no. 1=yes)?- Q- Q) G! \0 Q! @/ h
var pauseit=1: T1 e; {- `1 Z P. }. E
& v- M+ c: Q4 }. ?# C- |0 } A
//修改显示内容/ I+ t: |/ \% J, B+ F8 I( d
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
6 W2 v# g/ [7 e/ f) }- [9 {3 G( D$ K- o
: ~$ {8 x. r0 \3 }////下面不需改变////////////
/ Z% r/ h' j- L0 @8 B: Z% g2 V7 X/ C6 f9 q5 {
var copyspeed=marqueespeed! A5 V% ?) `% B6 }4 `6 K
var pausespeed=(pauseit==0)? copyspeed: 07 x d/ G6 x9 j+ Y
var iedom=document.all||document.getElementById
: l- ~) n" ]) u3 Nif (iedom)9 [+ F" M+ v# U7 o: {
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')% E+ J* p, `. `) B) F, \
var actualwidth=''4 D! v9 [$ I* K) _. d3 S" x
var cross_marquee, ns_marquee1 P. V! T- Y2 ^, M
9 E% U6 t/ W& g3 k: D' o
function populate(){ X6 o* i. w6 j0 a% M; [# s
if (iedom){- l2 h( B9 B" b
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee' Y, k0 N6 P' m+ u( ~
cross_marquee.style.left=marqueewidth+89 H- \. L( Y# ^0 b. H- B
cross_marquee.innerHTML=marqueecontent" F7 F+ @1 B% K( w1 K+ O
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth2 c& x# s$ I o- F1 \
}/ V/ g! }8 Y' q. A3 Q: ?
else if (document.layers){$ n1 h- Q& [ A" x! Y9 t) q
ns_marquee=document.ns_marquee.document.ns_marquee2
# R- {% |( P2 c0 B' p- Zns_marquee.left=marqueewidth+83 i5 {+ s7 ~- p; J4 W' V/ `6 ]
ns_marquee.document.write(marqueecontent)
0 W' R+ L3 H1 N7 [( o: ?! `% Cns_marquee.document.close(): g5 Q ^) {! _7 ]" M
actualwidth=ns_marquee.document.width" q' m) V' a) [* i5 ~# |6 g! R
}+ {! |! D% o) h0 w" t# g [
lefttime=setInterval("scrollmarquee()",20)' Q: {" i1 u+ ^) y T% N! i! G
}0 v/ t3 F( m; V
window.onload=populate" f; J. o, Q3 H ^0 M1 ^. N7 {0 W
- ]0 j1 ` H& O+ D6 a
function scrollmarquee(){5 J1 k- c4 m1 a& r& R, |# b7 u% M
if (iedom){
6 H' s7 o# R' q8 N Z( sif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
! r$ P) L" @9 H/ V' k% v& ?0 e$ ?% pcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed/ \+ R' ] J/ b/ y
else# _* x$ j1 R: |5 D3 j/ h2 g
cross_marquee.style.left=marqueewidth+86 B9 n9 C# V6 n
5 A! @; c1 R7 _2 e5 X6 X
}
1 X- r# k2 A# [2 V) _else if (document.layers){3 _( `9 l) \" Y8 C( P& |
if (ns_marquee.left>(actualwidth*(-1)+8))
. h; u' Q2 ~3 o+ O7 I gns_marquee.left-=copyspeed
3 k. m% o& [- i# }+ ^else% O! S$ U4 ], f% q4 }! j
ns_marquee.left=marqueewidth+8
7 e) j) v* ^+ u# T. n5 F7 M p}( W) r1 e( u& a0 |
}1 S3 |5 e# ~( L& C$ D
# j( A5 A- A( b m
if (iedom||document.layers){! o$ X" C2 U s1 y7 r
with (document){0 z) ~: w: o# c1 F6 W0 F1 s
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')( X) R2 `' u2 ~- z9 o+ u8 r
if (iedom){$ e- ^+ r5 }5 y. V8 [. N9 W/ [
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')5 W. l8 L, C0 b
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
" u" s" M8 W1 ] f6 j" b) bwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
& W n7 s! k8 U5 a. ~; U5 iwrite('</div>')
) G8 m3 _# U/ I: C}
$ \) e) p5 `% w5 @ O: A# aelse if (document.layers){
* F( t, C7 Z; T$ ]write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
! q8 d" w2 W+ u/ e# ?write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
; t* I) L: v: p7 j/ E2 \/ {write('</ilayer>')
5 I# K0 |+ G! P& f: R}6 _; E- j) Z6 W, y9 W
document.write('</td></table>')
- P5 ^: y7 @. k/ f/ Z: U}
/ \6 @- a& o+ w z( K. ~8 g* I}! \4 m' \; z! R
</script> |
|