返回列表 发帖

网页之跑马灯文字特效

//修改宽度
' `3 B8 i. F7 mvar marqueewidth=300
3 R  k5 |) O5 }2 i/ \6 g//高度- Z8 t! P% }4 x  m2 U, o
var marqueeheight=25
, H, S/ Y+ A+ o/ h- \# e//速度(1-10)
8 P+ L) H( S4 e/ @4 b, d! Q4 s* Mvar marqueespeed=3
, H% }. Q& s* r/ J//背景颜色
/ o% r% z0 h8 B4 [var marqueebgcolor="#FFFFFF"
. R5 {: Y7 V9 M8 B) v//是否能暂停 (0=no. 1=yes)?
) o3 G$ ~; I; a2 O6 J3 H! pvar pauseit=1
6 A( r7 ^' P# R; I  r- k3 w4 c: v6 |6 h8 d1 o; h0 ~* _
//修改显示内容% x+ s+ Q7 V# g* i0 p8 t
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
& g3 X! Y, A; ^7 a2 ^  n  |$ D% O

' E+ D4 g; a% G$ y, g& }////下面不需改变///////////// g$ O1 X2 A& k$ }! z

! w5 S$ C1 {7 w' s( }$ n3 Xvar copyspeed=marqueespeed
5 j2 C3 {2 n; @* x& ^# r& _var pausespeed=(pauseit==0)? copyspeed: 0( T7 b4 F8 w6 y5 q
var iedom=document.all||document.getElementById, }+ U( |6 G' ^9 V
if (iedom)  L! T) q5 V: {
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')& p. p4 _3 r* e9 {2 t
var actualwidth=''# b0 D  K, x  u* a7 }0 l& X5 D, h
var cross_marquee, ns_marquee7 `8 c0 x! ^, Y3 X8 K* u
$ l9 g/ H5 U! z# T" Y+ a4 n: B9 I4 `
function populate(){
- Q4 l7 P4 {, H: T" d. T# l4 Xif (iedom){+ F7 b1 k9 O4 E( S, C( }
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee' g) M. S* o( J6 a- R0 L- \# J0 x
cross_marquee.style.left=marqueewidth+8
( ]( y6 g' W8 s, `- _8 S' fcross_marquee.innerHTML=marqueecontent% T* i; m$ z) ~0 v  A
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
2 c7 Z1 Z$ S, w) X% n}" E* R/ U' }4 a
else if (document.layers){
/ J: E2 U4 [8 W/ j8 ?; v+ K4 Kns_marquee=document.ns_marquee.document.ns_marquee2
! B! D- A" i4 j% u0 O( V2 A/ |5 ]ns_marquee.left=marqueewidth+8( I8 R4 x# K/ q' {1 W3 U  H' \
ns_marquee.document.write(marqueecontent)4 @1 K' _2 l6 A% R9 C8 m  q5 O' c- J
ns_marquee.document.close(): [% g# }& ^! V- J, p: l* l' ^
actualwidth=ns_marquee.document.width4 c1 r8 ]/ m3 K: a  O4 k+ g
}+ m6 _! O$ O' P) ]* F# F: y
lefttime=setInterval("scrollmarquee()",20)
0 N+ s, _0 n) L3 ]& L& i}
/ M  p5 B8 U1 m/ v: e8 m& dwindow.onload=populate4 G! N# {/ u$ q( h2 z3 f# f% O

; f& }3 @* \0 Qfunction scrollmarquee(){
9 P3 h2 N  S+ pif (iedom){1 b4 [6 X* \2 P. i- N
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
' B2 o4 q. P6 v! Ycross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed6 m+ h# c# g4 @9 e# {- W
else
5 B) F. Q4 _. I% f. icross_marquee.style.left=marqueewidth+8
( Z) R/ W, p$ w! i; T! d" U
4 E! O  ?% a  Z# b% b" ~6 V}
& n1 r! |; K3 Y7 }9 s* Z& U4 Qelse if (document.layers){
) M6 y) x3 O' D# Oif (ns_marquee.left>(actualwidth*(-1)+8))
* T2 U7 U  R! i: xns_marquee.left-=copyspeed
, i* p3 ~! a% M. B; melse* J" r7 Q' C' b: M' n2 @
ns_marquee.left=marqueewidth+8
3 Z- H9 f5 K; L7 X" \$ C}
* G- o7 d9 U, J; V, J}$ f9 Z" M9 F+ U, u$ S
/ m2 p. e" B* D8 z: G
if (iedom||document.layers){
1 r; j1 D! G& I2 u& N5 g! Zwith (document){" o# q: N+ p7 w* P( b% l
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
% ?0 \5 G3 a& v" Q9 [. e- oif (iedom){
0 Q4 h7 A3 B# u9 d0 Y- Fwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
; e& G: ^# ~+ n- D# e2 }/ v0 _7 w/ @write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
  j1 M* v0 y: B! F0 j! V( w# ]/ X* n, ^write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')9 k) M" v( u. m4 G- K% ?
write('</div>'). i) u5 g/ c" @" Y
}/ ?  `% q0 j6 l, o8 P& L3 m
else if (document.layers){
; u8 U5 D9 j" Pwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
. Q# E. y$ S7 X* s4 E# z6 Owrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
8 k8 z, l; w5 ^$ m; owrite('</ilayer>')5 ~0 F  Y/ c8 u$ @3 z
}
  q& n! J0 A/ V$ Z6 pdocument.write('</td></table>')) W/ b) z5 P/ p4 u! q5 f/ b
}
0 B( a' `$ s# `' X+ ^8 r}; ~# o* I3 v9 y1 ~+ H8 Q
</script>

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