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

|
网页之跑马灯文字特效
//修改宽度" ^% Z! V. i) Q4 Z( ~7 \( b
var marqueewidth=300
8 C& }) K. h. v# C% O4 Q* U( }//高度
. i7 e5 B$ Z' C/ Mvar marqueeheight=25, V: C. }* W* F/ q* e2 @2 t/ C8 \7 f
//速度(1-10)( v3 `. Y. o8 J/ D' [6 Y1 a
var marqueespeed=3
0 ?8 ]( a: o' `5 i//背景颜色
7 C' L; p1 Q3 Z! G( [+ P8 Tvar marqueebgcolor="#FFFFFF"3 w/ E4 r" C5 d8 y; N- U
//是否能暂停 (0=no. 1=yes)?2 m8 e5 S8 t: Q' Q, Z, N6 n
var pauseit=1
- y. j5 ^ X/ V0 B0 ?, o6 S+ u
4 `8 g! D5 u2 Z//修改显示内容! k: g0 W9 o6 |8 y p8 @1 U: {
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'4 [, W' z( d& u+ z. f `& I
* `5 b; J/ U0 ^% H; Z- Y4 S* {! s& Q+ B$ d8 t& R, @; j/ `
////下面不需改变////////////: s; |) c' z: w
! H. O& T! G/ A- N% Q
var copyspeed=marqueespeed
0 y% @2 {; n/ ?7 ~var pausespeed=(pauseit==0)? copyspeed: 0
9 U# Y+ E' e) o+ g% g2 R! j |var iedom=document.all||document.getElementById
1 l9 r1 m5 P- V/ P$ \2 t' m" K1 ?6 |if (iedom)
) N$ V6 n+ F' hdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')# G! k3 E6 h0 F
var actualwidth=''
0 h3 [1 r' p9 V: L- D( Ivar cross_marquee, ns_marquee
- y8 C2 p4 S# ]2 O! t& s7 b f; H
! X2 L' B1 p/ @ X2 gfunction populate(){ I) m, n2 w" t3 [+ J; V2 n
if (iedom){
& k4 U U6 D" Bcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee; m; Q# H" c' {
cross_marquee.style.left=marqueewidth+8
a9 z N8 e e9 C, m) ]cross_marquee.innerHTML=marqueecontent
0 |/ C( R# x7 l& y( dactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
3 E+ ^( |* `$ @# t, P0 A}5 X/ k3 Q. ~6 A" A- ^% B+ b
else if (document.layers){
0 B K: Z7 `2 S" l7 {ns_marquee=document.ns_marquee.document.ns_marquee2, t; w v7 ]. J4 }+ e2 H% r+ }( h1 V
ns_marquee.left=marqueewidth+8. G( N; g/ G5 E* e- b3 `6 n! D; F
ns_marquee.document.write(marqueecontent)6 R: I. @% S; l) [) Y0 b
ns_marquee.document.close()2 i$ x- f$ D5 O6 ~2 ?4 G, u
actualwidth=ns_marquee.document.width
3 i( y; h7 J- U+ ^} x+ g( s6 m3 C
lefttime=setInterval("scrollmarquee()",20)
2 v1 ^* @/ i9 t# ^& V9 O}
L8 ]9 X' I) rwindow.onload=populate. X% d6 x' T/ l
3 ^/ G7 f2 v9 ^8 U" D
function scrollmarquee(){
" Z/ @1 h6 l4 [/ x1 Wif (iedom){/ W5 N0 }! X2 W _
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))3 j! q$ n. A& d5 B& W
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
' I! Y. U+ s0 _else
4 D& f- c* Z8 y( m& ~% tcross_marquee.style.left=marqueewidth+8/ i7 d- u! g5 v2 t' y& y b* z
$ |6 l& _* I+ v, A! b; f% j4 _
}
' X# O3 @+ |) F2 B" ~! e% F' k5 jelse if (document.layers){( G0 i# f6 V0 g& V- q
if (ns_marquee.left>(actualwidth*(-1)+8))' i/ n0 [/ ]: C U$ i
ns_marquee.left-=copyspeed6 H# l8 _) I. o" u7 s" M8 n
else/ ~! k7 x# W" I3 ?5 M
ns_marquee.left=marqueewidth+8
. B# c* S. {& T2 ?: W; L( q+ _8 t4 w}
1 \0 q( F/ ]; M& R}) z4 w$ R4 Y) e8 E1 ~2 }/ \4 R
8 D$ f- S, N: c/ E1 t7 ~" w
if (iedom||document.layers){
! m7 z! ^( r: h9 R& J2 ^with (document){0 {1 w Z4 g k
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
7 _: C+ ^; q% Z7 Gif (iedom){
0 z# b8 O) i/ O, d! s* O6 m& ?write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')/ G. v3 f' i* T( t5 p' B( G
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')' S0 W+ Q! f; W0 ^7 S# |; a
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
1 |0 q6 B4 p+ D: Z- q; t# \write('</div>')* w( ]$ {) b% f
}3 v' ]0 J/ b3 I+ i: |9 |5 q* i( w+ s& B
else if (document.layers){
3 d* Q9 ^( p4 Rwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')# t% U& n# J# [: X) |# L
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
" C# Y( a( s+ ]6 H9 O4 P' [write('</ilayer>')
* @/ K) w0 {/ z3 w+ I& q6 l}
( m2 Z; ~$ f6 P3 u# ]0 H9 Q, ~' Adocument.write('</td></table>')0 `& S/ m, I" t q9 H8 \# S
}
# Y# [) b" y. [) l4 x( E}2 e& n9 D- L, I; B/ a$ w
</script> |
|