返回列表 发帖

网页之跑马灯文字特效

//修改宽度
. I: \6 _  h9 B& Wvar marqueewidth=300& T+ E! n) @* N/ g" T
//高度1 _5 N5 ?+ _! a/ S
var marqueeheight=25) n) @( @( {3 z8 R- w5 i  ~" a3 d
//速度(1-10)
: t) ]# I0 P0 \, W, D4 T! I; m6 E9 ?var marqueespeed=36 m' o2 d8 j, J/ [5 c
//背景颜色
- V2 F+ V- Y& ~1 nvar marqueebgcolor="#FFFFFF"% H+ B1 }  f# h# S4 U: u7 H; L
//是否能暂停 (0=no. 1=yes)?
. {7 x& v- L) H: m4 ~; dvar pauseit=1) j3 [7 ], m; ?& b+ L9 |
9 N' `7 r( m; O) ~# u4 i
//修改显示内容
8 z" a/ _) o3 H; Evar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>') T6 A2 x7 ?! E* {7 |
. y3 \. P  w' [; Q: U

! ?8 e  j0 N) |* w9 O) P////下面不需改变////////////* S; b  E5 O) h! ]5 i7 T
2 M0 V$ B) c0 H8 q! a4 a
var copyspeed=marqueespeed
. C7 T5 S* V* P8 ^var pausespeed=(pauseit==0)? copyspeed: 0
, O6 O* F- n, T# P: ], M" ?var iedom=document.all||document.getElementById4 x* x+ B* K' i6 q( Q! h
if (iedom)
3 U: L8 R2 B7 Zdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>'); Q) o0 M/ S* n
var actualwidth=''+ e" q- {: L! b2 ?0 l( F9 L
var cross_marquee, ns_marquee
8 R& ~7 _5 E* |( P) b4 p- v2 S7 U% ?8 z, J$ s
function populate(){0 d! n$ w, R$ Z9 ]1 J
if (iedom){2 w1 L, @4 H6 }' ^* C8 ~* Q
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
" m3 X# P. a6 z/ Jcross_marquee.style.left=marqueewidth+8" z! m- U1 f. h5 j, V5 R
cross_marquee.innerHTML=marqueecontent
# {6 ^2 j: h5 Z3 a6 T$ oactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth0 K8 a# ~' s( [; }$ [4 {: s4 W! \
}; b+ v  X8 I; @; x3 l7 n9 v
else if (document.layers){- W* r* {1 _7 W3 o* @
ns_marquee=document.ns_marquee.document.ns_marquee2+ g6 \5 N/ q" ~
ns_marquee.left=marqueewidth+8( ~: I9 j/ B8 p% w: B+ E
ns_marquee.document.write(marqueecontent)
% W% W8 n. R& ?ns_marquee.document.close()
* w. K. a, O! b+ A3 k0 Y/ t2 Tactualwidth=ns_marquee.document.width* T% t, ~# a+ [; `7 G# T$ n
}
8 F' [( g- p" jlefttime=setInterval("scrollmarquee()",20)2 J+ z8 e4 W$ X$ P4 K, U) w
}/ w( I1 |5 q6 F" d2 k0 M
window.onload=populate
2 Y! q& }4 T$ l  @" U
# }/ D# f1 ]( ?function scrollmarquee(){- [- t/ \, A7 q' }* n
if (iedom){
4 d1 M- }+ u1 \. h. Y$ x7 Rif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
- b' S8 F0 p% T/ K: v7 A* Ccross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed( v8 J. h' Y3 n; ]( V
else( L# q& @% u7 Z$ D, ?& U0 F0 Q6 u5 ?
cross_marquee.style.left=marqueewidth+8
# k6 S) O& K6 [
' u; n7 x+ ^9 ^}
, A! ?2 D5 i: @: n7 Gelse if (document.layers){
  p. r+ F3 F1 f, p5 P2 L9 g0 R# Qif (ns_marquee.left>(actualwidth*(-1)+8))7 M; o2 L8 O# ^+ O
ns_marquee.left-=copyspeed
  M4 E# C  D* s/ melse
/ a* e& [% J* p; m: dns_marquee.left=marqueewidth+8
0 ]6 P: t7 j" G4 z# t+ W7 F}
6 u4 ~. q) k: @4 y' R2 g}) V0 i' u2 R9 G

' l2 y8 O+ {6 \" @& g$ d$ oif (iedom||document.layers){
3 a3 v. c) \2 a$ O( g% x2 Uwith (document){
6 R" v# V. L* g, K8 Odocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
- u! D& c! p7 R8 b8 Qif (iedom){
" o7 J+ x! q( f) f1 R' cwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'). l  l, N& `  o
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
9 N9 Q8 k9 t9 P+ F6 @3 bwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
- d+ [& [8 i$ s. N. g9 rwrite('</div>')
1 p' K  l" W+ a, f}4 e! |# J" j4 v8 X9 x& J* y! g
else if (document.layers){
4 U, ]) x1 h, gwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
2 ~4 B; J$ A: B9 a/ t, ^3 s$ uwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
, |5 J( F; b5 X- [, N6 Qwrite('</ilayer>')
. K* g! Y) O1 {# r& |- Z2 m}
. S* f3 C) A% m8 G4 ]; j! T& d5 [document.write('</td></table>')
6 O# n4 ]: ~5 u' v9 x( @. j% q}
4 O5 |6 n; z1 ]* C% I0 l}
: u: J  B" y0 L8 I</script>

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