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

网页之跑马灯文字特效

//修改宽度! O( u6 V" {/ y) E1 g8 v
var marqueewidth=300( j7 _, C4 B0 Y* F* w
//高度( h! G7 f0 D; v( |. d; C2 h
var marqueeheight=25
3 V/ l5 t+ t2 J' R  L6 C: x//速度(1-10)' S/ v5 o- a* o
var marqueespeed=3* k* n' t  b  f' L7 k
//背景颜色
5 r% {3 a- V" ]' X$ R, ~var marqueebgcolor="#FFFFFF"1 y# ]; E/ x) ]* O& j' Z
//是否能暂停 (0=no. 1=yes)?3 |& Q4 s+ c, q
var pauseit=12 A$ q, h3 ~- R4 h; c$ r
& A" S8 ]  C, Y+ f+ B  M
//修改显示内容) m( ^& C# G5 A- Q! h! x
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
9 u7 O* y7 S7 j# n) ?) d, ^& B6 {' g, P* }" G1 m4 n

. s3 n/ H' v" h1 u' h- [  k1 N* j7 d////下面不需改变////////////3 m: j" Q7 |+ ?1 w% [+ g. x+ T

/ y2 X6 [' `$ D  x* }  e( k! cvar copyspeed=marqueespeed
8 b. M. c( I2 _' D. bvar pausespeed=(pauseit==0)? copyspeed: 0' Q9 M, H) [. W2 I
var iedom=document.all||document.getElementById
6 J" Q0 T0 M6 n* X! ?if (iedom)
( R7 ~! S  Q7 }document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
2 D8 A+ Z8 T6 g& J4 r& S  Zvar actualwidth=''( V* w% O- t# E3 E0 D1 ]  Y
var cross_marquee, ns_marquee- z8 F. P& u# P7 o( r
9 N" Z- D1 D; }7 Z5 `$ D
function populate(){
* l( ^7 A* d5 _if (iedom){/ Q2 D+ i, Z1 {* }
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
8 ~* t- S+ A* \! \' L- P/ x5 ocross_marquee.style.left=marqueewidth+8
! _& c/ H/ b2 [8 O% Hcross_marquee.innerHTML=marqueecontent& P8 M4 J$ a" P# k0 n' b; Z
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth) @. e% b0 v0 h0 W. `/ i  e3 G- K) ~
}
6 R' M1 R- y- ^+ D; x2 yelse if (document.layers){4 j. C% L2 Y4 o- ]
ns_marquee=document.ns_marquee.document.ns_marquee2
% r- t+ |) u. D# {+ E" }3 Gns_marquee.left=marqueewidth+8
3 |7 v' h, `' L( q, L4 v4 ~ns_marquee.document.write(marqueecontent)
' I7 l, L, b6 r* }ns_marquee.document.close()& g0 w" b/ W7 Y
actualwidth=ns_marquee.document.width
# t1 o& X5 |7 j& Y}
9 H* ~( P5 t& e' Y7 t5 I' dlefttime=setInterval("scrollmarquee()",20)
0 R( v+ Z1 |3 H! G0 S- T}! R) e% }( `3 m8 C/ o' X
window.onload=populate
9 Z5 m$ X# y1 C4 a
9 W9 A; K: |( _# s% Ffunction scrollmarquee(){
/ J" A( d( V! K: n2 D9 w" x4 ]if (iedom){
2 }2 z" X3 x. B7 W. x! uif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)). Y, E- ^0 A; \. d" O
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed3 r" N  d# f! s+ o
else- X9 Y' o1 b% A6 G" a( p6 H- F+ X
cross_marquee.style.left=marqueewidth+8- Y+ Y7 L& K+ X" r( y: [7 l; n" h
# c0 V) Q1 D: r( [' t0 g; p
}/ O# F1 O  f  ?: G
else if (document.layers){
" R6 c; m; K3 c  f5 X+ C, _; h+ kif (ns_marquee.left>(actualwidth*(-1)+8))
' |) p9 b# ^; u/ N- R  yns_marquee.left-=copyspeed. ~& g8 p) _/ P; j, N
else6 F- H9 n1 d' a9 T6 r' z8 x
ns_marquee.left=marqueewidth+8
1 c. E2 y% v3 I0 x; r, J- i}
) a. m8 v) g% S- m3 _! l- n; U3 I2 y}
- g; ]* b( V' e2 |; h: @
2 \. Q. g) Y3 W! y6 cif (iedom||document.layers){4 |. D% a) l3 k$ g0 k  c7 s
with (document){
' B+ V/ M+ j4 i: m. t0 M% p* P9 _% kdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')  E2 V7 `* ?; b+ h. S% Q. j
if (iedom){& s  t8 J0 C; O7 k2 H
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')1 t: D: M* k& h. S! _
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
5 @- }9 X6 {- l  _* f2 y8 kwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
; l& g( d: x* ^" C( wwrite('</div>')7 {. d( b) c3 [- z2 K3 h4 K
}4 `! U0 r( e' |
else if (document.layers){9 M5 P& y, Q. I. R- q0 f
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')- q% X7 B9 M4 k: A9 E! r3 A" d$ \' a
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
' n; m# W7 a1 Y/ k" j# Hwrite('</ilayer>')$ v' V0 P" S4 t% |. v8 U
}
' k% b) u; V/ n" Jdocument.write('</td></table>')  ~. M) B& e' t
}
, b& B9 L0 G& k, N" Y3 r- r3 T3 D4 [( H}. k$ |# O/ t2 ^, w
</script>

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