返回列表 发帖

网页之跑马灯文字特效

//修改宽度
# p2 x4 ^8 `- D' Evar marqueewidth=300
- ?, F: \- N& e% N! w; V* [//高度
" M7 [. y0 F' g& mvar marqueeheight=25' x) f# Q, ]' `% a! C
//速度(1-10)
5 J* n. R- v  |' I% @4 Kvar marqueespeed=3+ f$ W5 C8 w( K
//背景颜色
% K6 a( ^  [# vvar marqueebgcolor="#FFFFFF"9 Z$ v, M( [4 V
//是否能暂停 (0=no. 1=yes)?, @$ R7 c( \# [0 D4 C
var pauseit=1$ l) A  S# y- I8 a8 u; u/ A
/ I( O% c( m& L+ x+ A" F8 F
//修改显示内容0 u4 g" w* [8 M8 b; A7 ~
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
& m) H% b7 _9 v9 l5 O9 c+ B3 A( p$ b3 W) f$ A& p/ v. Y

3 ^* f: k  s. b9 \+ C- l8 H////下面不需改变////////////4 ^0 c+ l% |$ `8 M. n8 A9 Y9 b

% p7 @; E) q1 ]var copyspeed=marqueespeed
' ?, }" x' W$ F3 Pvar pausespeed=(pauseit==0)? copyspeed: 0/ [8 \: U! t6 L$ C5 h
var iedom=document.all||document.getElementById" z( E1 P8 R2 J2 _' L
if (iedom)
, V; X$ j3 `5 W5 k( G' Wdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')4 O. }. B/ ~5 s
var actualwidth=''
& A! j9 X/ ~; [+ S) a% u9 y  ovar cross_marquee, ns_marquee
- n/ V1 Y3 E, a- B# |1 G" q/ c
5 G( \% a, E/ K8 n6 t8 A1 a. Bfunction populate(){
  |* [+ N( H) B6 c4 |7 Z7 \if (iedom){
$ h+ F8 w0 o9 y" n1 tcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee, t) o3 H' C9 j  r% Y
cross_marquee.style.left=marqueewidth+8- [) }; v! y$ J; j" E
cross_marquee.innerHTML=marqueecontent- ?7 O7 R) `( T
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth$ M$ {2 l; o+ p, x. {0 ~: R
}( K0 z# K9 |: ~/ i% i7 ^
else if (document.layers){
( P3 k$ G' p" a6 N' x8 `# sns_marquee=document.ns_marquee.document.ns_marquee2
# l6 g. g. r5 _; Ans_marquee.left=marqueewidth+8
2 r3 u% m/ S% X& G% K/ C" i; T! e( nns_marquee.document.write(marqueecontent)
& f% w: ^2 f9 q9 ins_marquee.document.close()
9 Z, @- y  A( dactualwidth=ns_marquee.document.width# k8 i$ l& A3 W9 e
}# z2 q/ q' W3 a
lefttime=setInterval("scrollmarquee()",20)  S: a) l2 ?5 y8 k1 j9 ~
}! g! v$ B( m* o( r. S, ?% G
window.onload=populate! y/ d( h% ^1 y1 g' \
, ~1 o' l8 m# }/ B" D) x
function scrollmarquee(){
$ I) B& W: Z9 u4 J2 k7 Uif (iedom){4 _+ ^# A& O6 w& k+ t) L. [8 J
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
7 s/ Q- a! F" {' d) m6 q! v# lcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
1 K5 |4 y! _/ @4 P7 K& pelse# M+ b- A9 p' S5 H
cross_marquee.style.left=marqueewidth+8
( O' {  o$ o. {2 @+ A( E) ]3 k  }  v( x) c1 ]3 I# \! @# x
}
2 V  @4 n3 O5 k4 q- F! M8 `# ielse if (document.layers){! |4 a8 ?3 Q' h8 w2 A/ M
if (ns_marquee.left>(actualwidth*(-1)+8))
% D. i) ^! e& Nns_marquee.left-=copyspeed
% ^. u7 t8 M, r/ welse: b; m& F% O4 g* n: j% |; {5 h
ns_marquee.left=marqueewidth+8* o2 g& T* Q. B4 B# ^5 {# z) n* G
}
9 U$ f5 b4 n1 F+ w0 S- t}7 q- E* F6 e  s

# o$ n0 x/ s1 K7 B- P7 D( @# dif (iedom||document.layers){) S! c1 A$ O; r5 {3 l
with (document){  l. t. b: w2 q  M3 w# @8 h
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')9 V# y( A6 N# I" _- Q
if (iedom){
- @- G6 O, h3 {$ n- B: Hwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
& r# v$ D, R6 Dwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')$ t' r9 q3 j) x# ^4 @
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')) W0 t; D1 t, {! ]
write('</div>')2 T$ r) ^( d* \& b( x' [; l
}, i0 Y5 O3 |4 e" n8 M) @- v% [
else if (document.layers){
( O9 _5 @0 V/ C. Fwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
9 F9 b5 P  P1 mwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'). u/ a; ?/ y; V" p6 v$ y4 N
write('</ilayer>')1 X+ C1 `1 h% y" ~# B" o
}
9 b# x9 Q9 E: _. F0 c; ~- rdocument.write('</td></table>')
! U5 U9 r' u; e4 S" v}# X' q/ h( r4 q# u2 X# U  s
}
* h6 p; w* Z) W* U</script>

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