获得本站免费赞助空间请点这里
返回列表 发帖

网页之跑马灯文字特效

//修改宽度! A; I8 A; M+ o
var marqueewidth=3005 i, d2 K. A- X0 x- ?' X. ]! {
//高度$ ?2 p( o- J( O) Q) q$ B
var marqueeheight=25
" M3 w  K: Z  B, X//速度(1-10)
) y6 W4 C: q7 R% q" w2 Fvar marqueespeed=36 U( U+ \* t' ?' H. b( q7 c% |9 Y: p
//背景颜色
0 [/ i/ p5 ^0 y% ]  nvar marqueebgcolor="#FFFFFF"+ P0 l9 U+ q& g. q# [  D
//是否能暂停 (0=no. 1=yes)?
* @" V# ^1 K7 f4 V+ D; ~$ rvar pauseit=1
- i! p& u2 Y. F& f& w$ j$ a6 I
1 _, a. D3 C: V* |' \. v2 B//修改显示内容
' n' d. v7 h% |# Mvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
8 x; n  W( _9 K: d- Q6 D
  _9 n! P- V: x4 K, v/ Y, {7 ~0 O* d9 E4 W1 _1 m
////下面不需改变////////////6 [2 R" O; I( j- q1 q9 E! H
& `0 q8 Y0 v3 Z+ V' l1 ^
var copyspeed=marqueespeed* j' _6 w* o! C* e- g
var pausespeed=(pauseit==0)? copyspeed: 0
8 P+ M/ g+ ~* }& X# L% W  yvar iedom=document.all||document.getElementById
; [- s  T" k8 Y8 e& i" Dif (iedom)
! g7 C3 U" T" Q* n6 o1 xdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')7 k& K7 I2 t4 v
var actualwidth=''9 x6 y$ R: f7 Z
var cross_marquee, ns_marquee0 x5 B: G; x  `4 a1 A4 d
1 y" q- G0 p0 a' Z  g' F
function populate(){
9 N5 Z8 Z7 l9 z: [: ^2 Hif (iedom){
. b9 l& A! \/ jcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee" h0 O& d) L- ^- ^% V
cross_marquee.style.left=marqueewidth+8$ g: x" d3 H/ O- D5 p! ?3 q
cross_marquee.innerHTML=marqueecontent( k( l1 K+ _! S; G" m
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
; A. r* n, I; j}
. |7 j% \* r+ Yelse if (document.layers){
) ^0 K: |3 t! S# [1 m9 dns_marquee=document.ns_marquee.document.ns_marquee27 s3 p; A$ {1 `' D1 n$ y
ns_marquee.left=marqueewidth+8
1 @0 E6 N0 p4 q% }$ j+ P6 @ns_marquee.document.write(marqueecontent)
* q/ ~) G; g1 n' i) gns_marquee.document.close()
7 Q: w3 N! k' v- J3 U5 ~" q1 Aactualwidth=ns_marquee.document.width
+ t  m; A2 s# w6 W, ^7 h2 l}
+ e& f$ @% U$ f& M9 h# rlefttime=setInterval("scrollmarquee()",20)
: a% q" }( }" n; w" g$ {}- N7 J/ v8 f* o$ B# P1 E% G
window.onload=populate' p: q6 j5 W, P, O

1 C0 _) M: E/ ^! f9 [2 Mfunction scrollmarquee(){& d0 f; S) ]: g) q! S4 o% }
if (iedom){2 Y9 B3 B0 i- X
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
/ x) _: b1 A2 n2 Z9 Rcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed- n' _+ u( H" H' h
else
2 E0 g7 B/ x4 rcross_marquee.style.left=marqueewidth+82 }9 |+ H4 r# A# \( m% Q. H

$ L: i: L& O7 f}1 p1 _! H, M, u2 A* [" u/ J/ R
else if (document.layers){8 f/ d% E; }0 s' ?  m' d
if (ns_marquee.left>(actualwidth*(-1)+8))
% L3 C2 o& a+ U& N% ~* Ens_marquee.left-=copyspeed
: M, W* i8 g$ k& [: w# E* Yelse
  V! L. E& v" V8 X) ^, w5 hns_marquee.left=marqueewidth+8' n: w" f& n# c/ a; g
}6 N2 x+ k6 g% j1 m* e
}
$ r  S8 F# r* Y3 v) w5 B, x% S4 y( u9 ?* l: ?3 G% h4 Q: v$ q1 I
if (iedom||document.layers){
: R, L' C8 s2 E9 s( n: ?  U! iwith (document){
' B6 M7 _" Y# L. n/ z0 W; wdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
. V5 U6 q4 P0 Iif (iedom){8 L! K, k+ }' ^, c; ~1 I4 v
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')- M# ^; _3 W5 I* b5 r0 d& b
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
+ S, J. a5 D4 Wwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
: K7 [$ H0 {* _/ Kwrite('</div>')# {' `8 Y: T! x) V
}. P/ _2 B$ I: l. Z
else if (document.layers){6 I) B0 y# ~# @, x" |
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')+ r  `% U# I: P0 B: Y- ~) X
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')5 _) s" @1 t9 Y  M7 _* G  B! V
write('</ilayer>')
/ S% l& w0 z/ q}  w( r. z7 B% ?, W: V
document.write('</td></table>')
) t2 `: l0 b0 d. ?( q, W}/ a# Y9 ]' w  J0 o
}
% L0 Y6 h. ^$ D/ U</script>

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