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

|
网页之跑马灯文字特效
//修改宽度
0 }) n& }3 @- }4 t- tvar marqueewidth=3005 H) u6 z) ^5 \- E7 ^0 l+ w4 ^* M
//高度
}- L; Y7 A0 J3 G4 _- ivar marqueeheight=25
) y; f+ J& Q4 o0 u* C& ~: F//速度(1-10)
$ L. ^! C1 ^- t. \- s; [* s3 H4 avar marqueespeed=37 ?! r+ Z% ~( t
//背景颜色9 c v0 Z" |, t. Q/ |$ v A* z
var marqueebgcolor="#FFFFFF"
( D: r4 m! H1 I! F//是否能暂停 (0=no. 1=yes)?
3 g( H. ?# f0 S0 qvar pauseit=1
{$ {4 `5 z( C- g8 F
% M( g! K. e, P2 J$ ^+ ?8 x//修改显示内容- o3 ]6 Y. C; B; u l: J% ~
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'1 Y' m1 U* V y* s
" d. }3 o9 K% x$ e9 v& ?' P k$ j9 e- a/ h3 w! h, q
////下面不需改变////////////
! n9 u( k% P" r. I; K% a8 G; a- C- X' |3 f, B
var copyspeed=marqueespeed: V& |+ q. ^7 n
var pausespeed=(pauseit==0)? copyspeed: 0
9 A. J2 h1 m2 _2 ?9 ~var iedom=document.all||document.getElementById8 @/ A7 }* k6 l6 _* p" t* s/ ?
if (iedom)
2 R O; Z" T% T' {" jdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
/ H! r n. x- }5 J$ d$ n- d! Wvar actualwidth=''
5 g9 T8 m; G8 s. S" U+ Q: uvar cross_marquee, ns_marquee4 j0 u6 r3 t) W }+ |* L
% A5 d! q: R( B1 [, W2 G& xfunction populate(){. r2 n- P$ o; d! ]
if (iedom){! G0 i% z% V# o8 q) J6 v/ o' i
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee0 _, S. O* J9 M; G
cross_marquee.style.left=marqueewidth+80 j9 x! C4 a! G# q2 W. m
cross_marquee.innerHTML=marqueecontent
% ]. d# n: Z$ X2 R4 y4 _+ p( Sactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth ^3 o6 @$ N4 o
}
7 ^/ B4 T1 A$ @4 ~( Velse if (document.layers){
$ V- }2 m k8 u' pns_marquee=document.ns_marquee.document.ns_marquee2
; C# i7 v, k9 m5 d; J W9 Ons_marquee.left=marqueewidth+8' A" i/ M) J# s0 {
ns_marquee.document.write(marqueecontent)
3 i f: n0 w9 i5 m! o& Y% \" Z7 ?ns_marquee.document.close()
, ^$ k1 r9 ^9 L& Sactualwidth=ns_marquee.document.width& U& c" I( r. Q) a
}
* N) B5 b6 i T1 u" D; S* Ilefttime=setInterval("scrollmarquee()",20)
$ M3 F. t P0 c( Y}
6 b) x$ f2 V/ T- P5 W6 i) zwindow.onload=populate4 g* s0 A3 Y5 r
6 s9 O- N: M! D1 Xfunction scrollmarquee(){
) ]0 K; e% n5 `5 y" P6 E2 y( oif (iedom){
( T; H" Q6 v; e: L r* b- K1 O* iif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
; n! I, Z. z& n: _" l! E' dcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed3 t, ]3 V: p9 Q8 Q7 C
else
8 K8 L2 h3 P2 d& J' jcross_marquee.style.left=marqueewidth+8
4 K1 l( g* E9 Q* {6 c
& P: v3 d) _: Y* ^8 Y}, V* o) u4 D3 A& r+ Q: J: w9 C) c
else if (document.layers){
2 [7 V6 F/ U% l+ ^5 J$ k# [; Sif (ns_marquee.left>(actualwidth*(-1)+8))
& l% o7 E2 N' t' g5 s9 bns_marquee.left-=copyspeed
6 P8 x/ M+ }7 f0 X! L- Oelse6 ^% q) z9 [# V/ [5 R+ d( [/ d
ns_marquee.left=marqueewidth+8
" W. `9 H/ ]/ U}
& T# ?2 f4 C& j' I}
0 n$ @5 B; i( |/ Y1 m# t
0 k0 r0 K+ X! r H! ^4 K6 H3 y' u) oif (iedom||document.layers){
% V' g7 `2 L+ |1 ]' E& u: fwith (document){
! {- ?/ {/ k$ Gdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 ?3 C: E0 O6 }/ D2 ]% B7 Y
if (iedom){
! @! H. y3 @3 s8 i% gwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
" s- }& H) r9 s# pwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')& B h% q7 q6 K1 m
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')0 }- S3 k: R; S
write('</div>')) u/ [, f1 f2 W I
}; \1 T( H0 y: \6 Q9 T+ w
else if (document.layers){+ [! D$ Q; {9 |/ V1 k( T
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
8 X9 k% K! S1 e( a9 f- S# u! T- w: k% K' swrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
$ X; Z6 Z5 Y' ?4 h J( lwrite('</ilayer>')
4 m% ?- ]6 d5 l8 J1 ^}3 H+ F, b* B; m( b
document.write('</td></table>')
& p/ L' y- Z/ C5 r6 S}% B1 ~1 b: p' G
}. m) ]8 w, g8 G2 C) j# w
</script> |
|