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

|
网页之跑马灯文字特效
//修改宽度 Z1 ?6 v& O) Z# p4 D9 F# |
var marqueewidth=300" ^9 m2 N$ C& O# V7 `' L8 {3 Z' m* M
//高度
" i3 _; U" z" |$ ]6 @var marqueeheight=25
- ], X V0 j1 p5 G( l//速度(1-10)& C" }% }$ m3 x
var marqueespeed=3/ v/ ^! v, p! a
//背景颜色- d1 e, v- e& W( Y4 R, U
var marqueebgcolor="#FFFFFF"
" F5 p: @) n$ Z: H6 I. B1 e- Y//是否能暂停 (0=no. 1=yes)?! ~* N7 P" y9 \8 {: h; |
var pauseit=16 W2 i2 {" f3 V0 Q
* D6 T# @ c h0 {//修改显示内容4 ?+ P% p0 @, e. P+ U( S( P
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
" @* k) x2 V- R2 E; \: t
3 d# I5 c: B X. L7 \( H H& U$ p- J3 c% v1 h5 L3 V
////下面不需改变////////////
/ L' H; k5 v$ k' f
( g' n% K. y2 t/ x0 T( Z+ V7 Lvar copyspeed=marqueespeed
. C0 P* l8 k' S0 O0 b, D7 wvar pausespeed=(pauseit==0)? copyspeed: 0
$ ]* p/ H S- y+ P( f4 Wvar iedom=document.all||document.getElementById# |* q* S0 ^+ t, I3 z! _
if (iedom)# e) m1 w6 c# r; `2 E
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'); Y/ b" ?9 F5 g% T! Q3 ?3 k
var actualwidth=''
! w" w, y: \1 f- g- kvar cross_marquee, ns_marquee. z- a& W3 y# ?/ l# n
3 ], J; g( G" d3 `- Qfunction populate(){6 a. i) g$ Q. }& b# u
if (iedom){& _9 ~8 m& e! B
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
+ N9 O5 `. [$ }0 Ecross_marquee.style.left=marqueewidth+8
1 ^% s0 S5 r5 i" ]cross_marquee.innerHTML=marqueecontent
4 R: w' L; ^9 k8 Q! y4 g& }actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth: a" |/ H0 l4 S4 z
}1 A$ |2 s6 `: H- x1 G8 @ ~1 z
else if (document.layers){) p, Y9 M) P( [3 s h f
ns_marquee=document.ns_marquee.document.ns_marquee2
( I( u+ M/ G2 jns_marquee.left=marqueewidth+8
$ ^) s1 q" a* W% a; F5 Q+ e' [ns_marquee.document.write(marqueecontent)$ V# m" u3 u/ _3 Z9 O _
ns_marquee.document.close()2 R* v" A; m# M9 w- T; U4 W
actualwidth=ns_marquee.document.width, f1 g: p9 u+ H: x: A/ M
}6 L I1 V) f; _% @
lefttime=setInterval("scrollmarquee()",20)5 q X' u1 z1 a: p/ c+ U
}& q4 @* Z; P9 P, ~ F& f8 ?
window.onload=populate; l5 ^7 s7 W) ?) \5 t3 w
! ~) B4 c: e* ~( G; a! G
function scrollmarquee(){
+ y+ F% }. A5 S, Oif (iedom){7 y/ F* B. Q) A: i3 T+ U: H& y
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
! a* l4 d9 x" I5 D5 l( U& Xcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
7 P! D f) {6 L1 ]3 D2 e: h! pelse& F0 v3 D3 Z7 R( X5 H+ i* {
cross_marquee.style.left=marqueewidth+8/ d. V+ I( j1 d( x
2 J: m' Z+ V9 @3 M}1 h* Y' J: T3 B1 C- {, Z
else if (document.layers){$ H; h4 O2 W. F( C3 z
if (ns_marquee.left>(actualwidth*(-1)+8))
. s/ \5 u+ e& A" i# p+ S% K) fns_marquee.left-=copyspeed" j. m0 }" Y- B5 V$ l) _
else
7 K, x# Y* m4 `4 P/ vns_marquee.left=marqueewidth+8
/ N4 E. [; q" m K) L9 U2 f5 I1 D}8 |3 P* p$ {3 @3 L
}
( L: k0 w3 ]: N. T% L& a
. b. H: i- x2 d7 J! x; G6 Wif (iedom||document.layers){: Y) x9 M- W |* U$ B- X B4 j
with (document){
" d( t" g! c6 g, ^document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')& g* s- u. n1 y: X7 p* n2 j. A0 H: b& h
if (iedom){
9 u3 i% T3 N, }- Lwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
3 Z7 ]% \7 ~. i* Bwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
8 A9 F# i" v m _/ z# Pwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')& q4 t" l) h* y8 N( m* `
write('</div>')
4 N* \ N( W1 Z/ L}
. T. F$ i" ]' ]5 s( `else if (document.layers){
. ]3 Y# F/ \# u" s; l' Ywrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')& N5 d: q+ ^) A: b9 f% E o
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
) T( a+ d. j; cwrite('</ilayer>')( O1 L9 A* H' S9 M5 a; P8 b- {
} k! Z1 Y7 Z: [, f* x s
document.write('</td></table>')# J8 o* a4 k1 V% _ `; W4 y ^3 A1 A
}, P1 Y4 y P* ~3 b
}
5 i) c) k6 Y. r% D</script> |
|