返回列表 发帖

网页之跑马灯文字特效

//修改宽度
+ U, \+ H# a  q  ^( B) Q9 u; mvar marqueewidth=300
( ?8 l7 b" H2 n8 k( H9 Y6 k) H( `//高度
, j+ O& k: [' \7 Z, v: A$ l/ Gvar marqueeheight=25" t! L! {7 H8 l) m# v0 |
//速度(1-10)
. x- n4 N9 ?5 ]) X! ]3 H; [2 xvar marqueespeed=3& v' Q2 [) H" o$ K
//背景颜色% Y8 C; [: E7 U7 y) @3 [
var marqueebgcolor="#FFFFFF"0 C* |- ]1 ?* S1 H8 q* L; l) w
//是否能暂停 (0=no. 1=yes)?3 _: X( G. e7 j9 c$ u# {$ a
var pauseit=1
8 r: n, j! q4 ~  J4 ]  i
% i5 w5 Z; W: n+ H, ~//修改显示内容
6 s7 H7 x6 m" Z# S$ N; bvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
  u' V! w: ~/ C2 z% g" _" W: e7 ]7 w* a' V

" o2 O: z- G& B# {" l////下面不需改变////////////9 L6 {  S+ r, P
) H9 |3 ]2 r2 z( }
var copyspeed=marqueespeed
9 E8 x1 e$ @9 G. V- e4 [: wvar pausespeed=(pauseit==0)? copyspeed: 0. S8 |5 v9 O$ w; G: L* \" g
var iedom=document.all||document.getElementById
- Q+ b8 ?2 `* A; I5 Vif (iedom)
8 V/ q* J6 ^2 e  y6 {0 W" vdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
# [: d  _  A1 x) i7 c7 s3 i- r; rvar actualwidth=''# a2 g0 L# z8 ]% M0 l8 m
var cross_marquee, ns_marquee
  s; |0 j+ r) y  w+ L0 i9 q! f
function populate(){
. J! |0 X2 T# {; _' sif (iedom){  y; a9 V4 g+ j* E7 L2 Q3 Z( I, M
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
3 K1 z) T0 V5 lcross_marquee.style.left=marqueewidth+8
/ v" s$ [0 Z. `3 E9 Vcross_marquee.innerHTML=marqueecontent2 h3 y( c) k1 h
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth6 j: Y8 F3 |9 `% i* s9 @& W
}
4 a% Q8 S' N6 H9 x% Uelse if (document.layers){$ F0 N2 M* ^* ?& f  S8 ~
ns_marquee=document.ns_marquee.document.ns_marquee2
" A: N, U' v5 O( O- Zns_marquee.left=marqueewidth+8
: J. t) O+ `! u! K* @ns_marquee.document.write(marqueecontent)
% p5 K! h+ j7 }0 V$ c) B# cns_marquee.document.close()
* {7 [3 P5 F- Zactualwidth=ns_marquee.document.width3 k/ r1 b; z# D) @; @
}+ X* U  M& ^. `* ?
lefttime=setInterval("scrollmarquee()",20)! [: j: S% W3 }2 q! [- I
}
( q& x7 r) I% ewindow.onload=populate" p' H9 X* i1 q. E
/ `3 _& f/ T. s2 |
function scrollmarquee(){1 _7 R$ G& k# P
if (iedom){% g% P5 m# C. T- D+ Y
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))4 W# n  y: S4 f+ B6 _7 T
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
2 P" q2 K% Z9 uelse
( a5 @+ B4 E4 d4 C' |$ I+ j. h; dcross_marquee.style.left=marqueewidth+8$ Q3 _6 ~3 v7 z6 u

6 d8 g" c% z4 e- y: X}; E3 ], O, d, i, k1 G* W8 }" o& Q
else if (document.layers){5 b9 Q5 j/ @5 v! S6 m5 J) m; s
if (ns_marquee.left>(actualwidth*(-1)+8))' a- P/ X7 e5 U& N0 ^% c/ b
ns_marquee.left-=copyspeed9 K6 N  a# h' {" Q
else* q; }% t2 N  `
ns_marquee.left=marqueewidth+8
! S. y  `7 X" u5 B# r}' n7 b) P& l* F) l
}
. C; e8 V$ P4 i, q4 l, v3 k  d" G, f9 y( V1 n: I8 `
if (iedom||document.layers){
, g# R1 d& B' ~with (document){% {2 g5 v( S( j
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
2 s9 q/ {/ t/ {* V& m, ]2 v+ b7 F- h/ Rif (iedom){- s% w1 j# E2 a- p
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')0 V' ~2 h6 a% q1 g- s  w" ?) j/ r
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
, A0 u$ {" F9 K( q6 e$ z* {write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
+ }4 P( [# p  T0 x( ~& p4 Z- b  \& Awrite('</div>')
$ ?& ]- l; J1 C; c}3 Y0 X. h) a5 ?9 H) k
else if (document.layers){; O9 n1 i* A0 z, }+ P8 A( g
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
2 ]4 G2 ~6 l1 c1 _write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
+ Y$ {) e* B. j; N. cwrite('</ilayer>')
2 o1 R# ]& J1 U# [0 A' \" s& p- A9 B}: z9 J8 ~1 B# T. W8 h( A
document.write('</td></table>')
- _& |1 y( |# B7 Y+ m: P}) E9 r7 L7 A9 P8 K
}
# x# r5 h$ T9 s: |( e1 y  Z2 n- |</script>

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