返回列表 发帖

网页之跑马灯文字特效

//修改宽度/ r& |$ c: K( ]) X# h
var marqueewidth=300
3 j3 C0 k# A0 l7 A//高度
" g- r2 w4 ?* N0 Q8 J: bvar marqueeheight=25$ J( J; h) o- F, F, Q: o, I
//速度(1-10)
* ]# m* Z& j, h/ F  yvar marqueespeed=36 q$ ]: W7 @, Q3 V  H" i& k
//背景颜色
* T( Q- n+ T8 [. P- M. [' Pvar marqueebgcolor="#FFFFFF"
* l& @) M) M& ~' G- ~2 g//是否能暂停 (0=no. 1=yes)?
) q- @* a! r3 {, avar pauseit=1& g2 m, b7 }3 j: x

+ r7 E# z8 q. L/ G& n//修改显示内容+ x; c3 o* b1 j9 @4 t2 |: Q
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'3 e4 c0 t; J2 O, d/ e7 A

' Z! E4 v1 X7 }# W' U2 f
( `: w/ B: m: q7 x2 Z, x////下面不需改变////////////
0 F% p1 {6 u' |' I" A: R. X
) c; V- m9 s# O8 r( Fvar copyspeed=marqueespeed
# ~4 F5 a3 C; n8 avar pausespeed=(pauseit==0)? copyspeed: 0
! l) _) B9 j- v4 K0 Svar iedom=document.all||document.getElementById
' R: a# v" M& ^3 N& c" Qif (iedom)
& V3 w/ _' V" d, M& u: Q# r# r# \; Edocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
8 n5 H) j& E: O: i5 ~7 w8 h, c$ evar actualwidth=''# P  }  n0 g: v# y
var cross_marquee, ns_marquee
  ]3 M- |1 @: e! t* J9 [- F$ f' V
function populate(){
: B$ o) l& u& n& p2 ^! [  Rif (iedom){! J% ~/ }# d# L/ i8 x
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
: P. S5 k3 U& F# W0 R& Ecross_marquee.style.left=marqueewidth+8, \, {4 L* S) M
cross_marquee.innerHTML=marqueecontent
$ @6 H  T& z; S9 s& xactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
: p" C- U6 \5 H: c: J6 w}
) n' M* v! s6 [1 A7 {- Uelse if (document.layers){
; M. s: m8 v1 w% r3 ^% }$ v& @ns_marquee=document.ns_marquee.document.ns_marquee2
) [6 N  {, F5 j8 z+ `; O3 T( xns_marquee.left=marqueewidth+8* S) i$ P9 X+ C% \
ns_marquee.document.write(marqueecontent)
+ H7 X7 q% |: }4 U; v% ens_marquee.document.close()
1 f2 c3 _4 U4 u( t' ~- T0 v  aactualwidth=ns_marquee.document.width
# @( E& I0 y$ Z3 Z  s}
% e- N7 R# f# I, a) {/ a# W7 F  [lefttime=setInterval("scrollmarquee()",20)
) v! A9 H, N. j}: q! U' P& a' ~; K6 @: p% [1 d$ a  M
window.onload=populate
0 E& L1 \6 I( W+ N% ~8 q8 e( @' e& W
function scrollmarquee(){) r! j5 {7 C0 k6 c5 ?
if (iedom){
, x3 v* x' p8 T& {* U' Vif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)): I. T2 C. F. S& p3 `4 x- z
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
$ O; r0 U: G; j% Delse
  b: w, t. _: G. x$ V1 j0 zcross_marquee.style.left=marqueewidth+82 _: _3 b* ?2 ?
& ?% s2 H) g  d6 x8 w
}
. q% N3 |5 s9 Z6 ]else if (document.layers){# v+ O( h( f/ k$ p/ o$ N1 _8 t
if (ns_marquee.left>(actualwidth*(-1)+8))
  \0 V& d0 X  l3 Fns_marquee.left-=copyspeed& n0 n5 B! s' H# y5 z. F9 q
else& k; |6 C1 s' F' t
ns_marquee.left=marqueewidth+8
/ ]: }9 W; e. B( J0 f) k}
! P1 _6 L5 g7 R6 o5 f}
; B* F: E0 p, u" w$ ^( A
7 y4 T* S( l- `if (iedom||document.layers){0 X- f5 Q1 m0 }/ F6 ]. M
with (document){
5 j. d1 a1 ~- l- ]7 o: i# Bdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
9 r& ?+ x5 t, g/ {if (iedom){- B, e' H$ p6 q1 ?# H
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')5 Z. @# s, A3 @, @( l3 P2 b+ E4 |
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')  G3 m5 U5 t1 X
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')! Q/ W" D  h. l1 y6 F& X
write('</div>')
" Y6 g0 L2 w- q5 ]% E}% y2 ]9 v+ \* X
else if (document.layers){
; n/ P/ k8 }) u* {write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
& r# K6 P4 b/ e; y. |! nwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')( c& v* u: P1 k; ?1 \/ g
write('</ilayer>')1 c: D3 f* R2 {9 R9 \5 q' w" P/ v9 \
}  t- e3 ^+ R. K" Q4 {- Y, T1 E
document.write('</td></table>')2 p; y1 o0 t8 _, y. W% Y
}5 k+ j4 l0 b+ t
}
# N% S- n8 O; Q! z2 N</script>

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