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

|
网页之跑马灯文字特效
//修改宽度6 U) p( T+ D4 P! n7 k9 p
var marqueewidth=300
( Q4 N% r2 i, Y& }. {//高度' A) K+ h+ p5 p( e# ^0 A' s
var marqueeheight=250 S3 o6 V/ {6 m4 _& ^: J7 j
//速度(1-10)* d ^% w+ U& V8 p
var marqueespeed=39 F* M0 R" m# {, r/ K7 {) m2 t
//背景颜色
0 ?$ W4 G2 I- Q+ n6 R$ p. Rvar marqueebgcolor="#FFFFFF"
0 o( d; g9 S1 b0 [8 @/ c//是否能暂停 (0=no. 1=yes)?
6 T( K; _, ^$ kvar pauseit=1
& q" C$ `) X" D
5 ]; w! s9 U7 w' g//修改显示内容- h X. U D' l6 S+ ^+ A7 t
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
! V) {; R- m1 _! r/ ]' c
6 j$ w# `3 B% r( ~$ N
* H/ Z) q/ A0 u; P, l# B1 m////下面不需改变////////////8 l! X# W! B9 E/ t5 E, }+ K
4 ^* A$ p: I" f3 _' U$ \* Zvar copyspeed=marqueespeed& J% L' O0 t B6 N3 y C/ V- {
var pausespeed=(pauseit==0)? copyspeed: 0/ u1 N. o- z) Y# P. O; g6 V/ n* a
var iedom=document.all||document.getElementById
2 ^1 {; m" F+ ]& N% ?, Uif (iedom)
! H4 \ R' i" Tdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')+ F9 l3 ~3 E) w4 r F- n! \; D; F
var actualwidth=''
; t$ I8 D# ^" {3 _2 g# S$ Ivar cross_marquee, ns_marquee- x Q( d( J& u. o( ]
9 Y/ ^/ W! d, o" [ K
function populate(){
) p/ C+ _/ V- d; I* Iif (iedom){, D9 t' `" K. P
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee. {1 O3 o1 ^! L
cross_marquee.style.left=marqueewidth+8
0 s1 ?5 I- g2 `# K1 I. o& Ocross_marquee.innerHTML=marqueecontent3 ~ E. n5 Y8 ^8 {0 X7 w$ R
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
8 ]* L' ^3 L4 L0 t/ y2 B}
9 J0 l' H4 P Q6 telse if (document.layers){
B) a1 Q8 v! G0 e! N* xns_marquee=document.ns_marquee.document.ns_marquee2
! R/ c/ S, S: n& Uns_marquee.left=marqueewidth+8
, R+ x* |* Y- z% a' `9 zns_marquee.document.write(marqueecontent)
$ S: w/ F& D( C# j0 C5 y' ans_marquee.document.close()5 r7 |$ V; T) u" y
actualwidth=ns_marquee.document.width; ~# w$ n8 f2 I* i: P9 K
}
9 f. ~7 x! [7 @- c( [lefttime=setInterval("scrollmarquee()",20)# @* b) k/ ?5 q$ t
}3 {& { H( L% b! [0 r
window.onload=populate% G, H, v1 X$ ^+ E
/ }' U! f. K$ g8 z* @6 e
function scrollmarquee(){
% R3 K5 \* `* wif (iedom){
) h4 m4 B( @" C# L3 a3 D/ X6 mif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))4 Z/ Z" n' D R6 ^ ~
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
- [% ^: [. ]9 r, w! a) f; j$ R( Xelse5 f5 ?% E; j3 ~# ~
cross_marquee.style.left=marqueewidth+8/ G1 D+ j) {8 l' @
, L* I4 P" H* W7 h' i* k0 w
}" V1 j0 `6 p+ _3 h! E
else if (document.layers){7 C, }3 b* [8 E, [. t
if (ns_marquee.left>(actualwidth*(-1)+8))
) L5 o: E8 _. E4 o1 g X9 ons_marquee.left-=copyspeed
i, W" H1 ?$ F welse. C* l, q% E4 v& p
ns_marquee.left=marqueewidth+8
Z% B( D! y, B8 _' |4 e}& U0 k6 C1 Z1 z" _) t2 i
}
. K9 f& N! L3 P- b9 A" Q2 h
. H( {8 `4 N o: b* e0 m% Z4 iif (iedom||document.layers){
$ z8 \6 Z/ R3 P; s' n( zwith (document){
5 y& F1 b7 F6 w+ ]7 K( @document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')9 X! R% p% ?) Y0 C. S; ~
if (iedom){, s) Y& }2 d/ `, c7 h$ }
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'): \) G9 }# u2 r1 T
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
5 b R. \$ i( X" C7 Vwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
! h2 T6 { z; {& H3 p4 Z7 Y8 C Cwrite('</div>')
1 e: W' b, B8 i$ L) z; Z. p}/ H- \7 g! ?# r8 I
else if (document.layers){
( J& u: D: @1 B; qwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')" N3 g6 b( m3 A7 V+ J! ?
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
2 y/ X) F5 d. A* |write('</ilayer>')
9 |" L7 S, l c4 s* D' L. K2 s2 g}
/ P; j; \! R2 Xdocument.write('</td></table>')0 F% |1 v" G2 c% e$ c/ S" K8 |
}% l7 a" i, t6 }1 z
}. a' P; S& r( O" i' f
</script> |
|