返回列表 发帖

网页之跑马灯文字特效

//修改宽度
# C  `  K; j8 M* i" ~7 M1 Dvar marqueewidth=300
# a+ b% B. U6 o! r4 A) I$ e' Q# }//高度
: o, x1 K7 B# }  C1 \& cvar marqueeheight=25* }% T1 X$ w% |
//速度(1-10)" e2 i( f  V8 o* A
var marqueespeed=3
% c$ g" M3 u  Z( z) e//背景颜色
% ?" W& G, G+ Tvar marqueebgcolor="#FFFFFF"9 ?( q4 U4 L8 g' \( }* [) K
//是否能暂停 (0=no. 1=yes)?: X1 o7 ^% x$ l. \3 a9 ^; i- `
var pauseit=1
, O- K: K% D: `- x
, e* m0 Z7 N! i; Q//修改显示内容
+ e" L" K( L" j  F* ^7 Bvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
1 k' \! G2 }- r; w0 D: s. h0 x3 t" Y; O( ?, C( x! Z8 p

/ _% x6 F6 A1 `; U& ]////下面不需改变////////////
! L6 U* e9 [0 l6 j" o* a2 V
* C  M. v" E6 c9 j* p5 u$ J% Qvar copyspeed=marqueespeed8 R; W9 v4 T) ~0 q& q
var pausespeed=(pauseit==0)? copyspeed: 0
+ l. w$ m: M) O/ dvar iedom=document.all||document.getElementById* z  Q9 a+ r3 F' A/ K% [
if (iedom)8 \0 a' B2 N, D/ O
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
# T1 G9 L6 `. f3 bvar actualwidth='') @6 M  c) |1 j8 ]) e
var cross_marquee, ns_marquee
2 ]) A; f  Z1 F& S; y5 I. E( `+ ^% w2 ?
function populate(){
; ^( K8 N1 ^* ?! S0 a* T9 [% Hif (iedom){
: ^% K( V3 u) ]" x; ncross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
# Z/ P+ D" S1 L& E3 P1 h. ^7 Across_marquee.style.left=marqueewidth+8
/ I. c) b0 x# t, b4 Ccross_marquee.innerHTML=marqueecontent6 z6 N. z0 _- j5 d+ \( |
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth6 Z1 }/ P7 C0 n4 C8 b) m/ t
}
) e6 e5 g5 Z' O" Velse if (document.layers){
& O6 _& |, i! ?) {3 H- {ns_marquee=document.ns_marquee.document.ns_marquee2
/ s# C' D4 ~5 g% I+ C  t3 G7 ens_marquee.left=marqueewidth+8
: C! N8 p: b3 _6 @8 ans_marquee.document.write(marqueecontent)
: l" ^- @4 w+ Y6 R* W* gns_marquee.document.close()
7 @4 P. _4 }2 ~- s* Oactualwidth=ns_marquee.document.width- B- Y8 @1 e" B! m% h, E
}: |9 |6 X4 d- q+ ^
lefttime=setInterval("scrollmarquee()",20)  C8 J6 G' I; {' N
}
0 Z. k, o# t1 rwindow.onload=populate
8 ~# q$ ?) o1 |9 P
3 t) \4 ~) {8 p, x( l" Cfunction scrollmarquee(){, q$ q- [6 T5 f8 S# Y; R" ~
if (iedom){, d1 k1 Q0 M. q0 J3 t
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))9 ?' S# i' A6 [) n0 \
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
9 ~! H. r, i* |" ^: a  selse
8 v0 V- o/ N, D$ pcross_marquee.style.left=marqueewidth+80 V9 m$ n- G& c. i

: Q- Z1 P7 b* x& H+ C; a$ G( T! [}5 y% V  j4 I5 o4 I
else if (document.layers){+ f9 D  O# j4 _/ v
if (ns_marquee.left>(actualwidth*(-1)+8))
9 O( l- X4 ]+ S9 }9 Wns_marquee.left-=copyspeed
$ ~* q: g9 g/ k3 ?7 oelse1 a$ m  j2 q; n! E. L: {0 P3 a# D
ns_marquee.left=marqueewidth+8- u. p- D1 E/ p- N
}
% h4 s6 `; j! ~7 X* F" w}1 B$ i' a; e1 K- \

8 R; u0 M5 R0 C; {1 i) tif (iedom||document.layers){
1 k6 R& V( ]  [! Awith (document){  `; ?3 _, i& h% r' e
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
- a8 `/ ]6 Z- m" D& {( A. gif (iedom){
# n' i7 v2 H' E2 t+ `5 q6 a& fwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')) _% X+ m8 j7 U& N4 F& L
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')  A& t% i( _% S
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'), o* x+ T' d, |
write('</div>')
/ D9 g/ L- }% J; s9 g- n4 g) G}
5 i3 T4 A- G+ Relse if (document.layers){
) F' S1 O) e' N; _* W$ F3 W* `4 l+ Jwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
! s& J/ G, N1 i  `7 ~+ k' Vwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
! O0 s$ Z- X9 c; \+ y" {9 ]write('</ilayer>')
0 H6 v) {& I% z- h( w}$ _7 o6 @( Q- z% i- {
document.write('</td></table>')
# r; v! A- V" j: N4 H}# N. o3 @6 W+ r+ m& g0 f  ?4 R
}
1 |% O$ d9 [9 [5 N</script>

返回列表
【捌玖网络】已经运行: