返回列表 发帖

网页之跑马灯文字特效

//修改宽度
' C' n! q$ E' T  [4 `& X, ovar marqueewidth=3001 B0 {% m5 q- i' l6 A, d
//高度
# V2 M+ w4 `' B7 L4 a/ s0 Hvar marqueeheight=25
; ?8 ^3 {% I7 z2 |: B9 D8 R//速度(1-10)" f2 O* X# i% `- R, b7 V2 f& n
var marqueespeed=37 c& ~" }9 B8 Y' I- I/ {* j& z
//背景颜色/ A( R- @" _0 c; ~5 R+ I
var marqueebgcolor="#FFFFFF"; ^( Z# F6 g1 i$ j
//是否能暂停 (0=no. 1=yes)?2 E/ w( y7 U! v8 K" r, t) z
var pauseit=1
8 o* ?! i0 j9 c( g: ~/ R. _- _9 n9 }5 ~2 D& j7 h
//修改显示内容2 \$ `0 Y  o6 ]- N0 B# K
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
. r  Q( \/ W# n- R/ @& R; n
9 v( I! _7 J3 L  o/ I2 A" j7 t# [/ J6 z. j2 m
////下面不需改变////////////
7 x' @8 Q/ Y1 p! R$ G' @7 H- W7 x, _* k+ F4 H% H
var copyspeed=marqueespeed3 `- `/ _) G- g: b
var pausespeed=(pauseit==0)? copyspeed: 0% C8 f* ]5 m& X/ ?
var iedom=document.all||document.getElementById
6 V, `* Y' j  l6 ^  U+ m; I3 U: wif (iedom)
5 F6 p& |& G$ X( Y# v! ^+ j4 fdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
4 j. C: y3 x6 X, \- Z- Q+ m  M2 Pvar actualwidth=''
, T/ O7 [5 t& D+ u2 Y: u/ cvar cross_marquee, ns_marquee' K' l1 W! `1 F- b. W' K- a

2 O' V/ k: B- O. n* Xfunction populate(){
1 e' a/ D8 g6 i7 {7 [if (iedom){% x/ c; Q4 h- D) R
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee: Q( j2 w, h. i  R' I$ n
cross_marquee.style.left=marqueewidth+8( a7 X* D1 t6 m# }+ z8 a- Z) s
cross_marquee.innerHTML=marqueecontent3 b& E# U1 o3 |  k& O
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
) g0 C  o: d; @; h0 w) o}
" v5 I0 I5 u# T6 Yelse if (document.layers){1 p$ `) p- L5 S: O# y# C* \- Z$ B
ns_marquee=document.ns_marquee.document.ns_marquee2
& P. T: g& c+ J7 X% Z& qns_marquee.left=marqueewidth+8
  A5 F) A2 V; b' ]" Q# f6 nns_marquee.document.write(marqueecontent)* B+ n0 I# ~2 r6 U  ^
ns_marquee.document.close()" y4 s/ @# |7 Y, b1 b* H) u% m
actualwidth=ns_marquee.document.width0 }8 n: i* A7 l/ L2 @3 w1 w
}
/ v0 i! a/ W0 F  Tlefttime=setInterval("scrollmarquee()",20)1 C- o& f& }6 p
}
3 ?  u# Q0 O% G  Cwindow.onload=populate
* L/ A+ v7 \- i) N: ^
; f6 d) M* `, h# U  pfunction scrollmarquee(){
& r6 R- u3 m5 B; T. Q' L7 `- eif (iedom){
4 Z5 m( ?& q5 kif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))2 u. @  v& I* j3 {
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
' A! {, j, i% d2 r9 _else( L& P, ?" c' w
cross_marquee.style.left=marqueewidth+8, x$ t& g. {7 V" F: P+ V
9 J" ~& M( F9 D: ~! ^
}- g, f# [8 H0 U" A/ K" u  s! [
else if (document.layers){
' }5 ?. ^7 V( V' T& r- Qif (ns_marquee.left>(actualwidth*(-1)+8))- N* e3 B0 w8 w* v% o6 j0 M
ns_marquee.left-=copyspeed
( O" m8 @" m& w" P5 celse
6 t$ Y8 M$ P( a# U* S3 S! Ons_marquee.left=marqueewidth+8
- ?  A. K% J2 ~. {6 }3 X6 f}
. ?) d: b+ j* M1 m  ?( L}$ l* r* l: P; k6 G% W  z

2 P: N. P( m5 k" w- l3 wif (iedom||document.layers){" Y/ j$ Z7 Y, ^5 J. @
with (document){
6 N: B3 o. A* k* I; j4 E) k1 w4 mdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')% }2 `8 r& y/ _3 q6 |# ~, c
if (iedom){
$ t' @0 ], v" qwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')5 a; I8 c+ b& {7 ?; e
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
% D, @" W6 L: g( xwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')# L: P% V& i1 G
write('</div>')
5 C% S# x0 p+ }6 h# v! R; }8 J}& G* y7 K9 w. C! _" P
else if (document.layers){6 m8 L2 |+ S* a2 A1 x
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
( B' F! P* m* W% x' ~' v9 W2 R- ~write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')2 R; l  m" H+ t2 a2 ]
write('</ilayer>')- Q  d9 w. C" V& y) N
}) Q2 s0 m+ }/ h* o# V0 {
document.write('</td></table>')
$ V3 a: i2 ~  Z1 ^+ a}
3 j( z* X% _" X! F% o  Y, \. Z}; ]3 c- B) P2 E. J' S7 a' H
</script>

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