返回列表 发帖

网页之跑马灯文字特效

//修改宽度
( Z1 M8 ]$ N* X! Z/ Ovar marqueewidth=300
4 k" A2 S3 B4 e1 A/ A4 O( t//高度
* H% D' S. W) }6 U& c, v; Bvar marqueeheight=25* `4 ~. X+ u2 i2 v( ~
//速度(1-10)
! L, M6 `$ b( G( L, kvar marqueespeed=38 O$ K$ a) f) Z3 `: T
//背景颜色
, Z  Y6 c, r# M# Svar marqueebgcolor="#FFFFFF"2 _0 p! q# |# g' K9 |4 ~' F
//是否能暂停 (0=no. 1=yes)?# e3 ]  H0 h6 _- I0 t% q
var pauseit=1' }% [& T* @3 A) x" ^
! G$ x9 v: Q. _/ w7 q  u) k
//修改显示内容
& T$ @; V- N  _, dvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'/ m, ]3 o# F4 E3 D6 R4 G5 J; N
- t& z+ ]/ `4 ?  O, |5 s" b

3 ]: e  ~( ]* ]+ v) R* j% f( _8 q////下面不需改变////////////. a) Q$ S4 t0 y- S4 u/ N' V) l
9 R! z; l# r/ h. H; R) |1 n" {
var copyspeed=marqueespeed
9 V" M) F: o5 U3 j3 D- \var pausespeed=(pauseit==0)? copyspeed: 0
9 `1 z* Z, N1 Y/ R  m: J6 jvar iedom=document.all||document.getElementById( [, S& S, b4 c9 O1 o% z* Z7 v
if (iedom)( o9 [: |: T+ ~8 O/ G. ]* n
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
2 d/ U6 l! H9 `, Nvar actualwidth=''
& q% u$ O, I1 N2 D9 G9 }var cross_marquee, ns_marquee5 Q; E( O. [; b- q* y3 G, Q
' y" i2 R. }9 v8 K
function populate(){% O2 K) h& M$ ?0 w
if (iedom){
( D" q0 F7 M5 H5 mcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee" f. C$ P. X' U
cross_marquee.style.left=marqueewidth+8
9 B* H8 {: d* B7 Mcross_marquee.innerHTML=marqueecontent, Y9 @- b$ I4 ^3 ^3 [
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth  v) K: y" Q$ B# L( t9 s+ M$ e
}, `: ?3 W2 [; ]$ r7 G2 H- ^! y
else if (document.layers){
& G: m, b6 B' zns_marquee=document.ns_marquee.document.ns_marquee2- D+ P5 R' Y% [. [
ns_marquee.left=marqueewidth+8& w# S& I: s0 A, `) }; W' ^# f) X
ns_marquee.document.write(marqueecontent)
) J, Z7 k# d/ ~- U9 [: K: f( nns_marquee.document.close()% W/ U7 _9 v, P* N
actualwidth=ns_marquee.document.width* E+ M3 U# D0 B
}
( V# }1 Q7 B7 i0 o# nlefttime=setInterval("scrollmarquee()",20)
# _( d8 i$ K. x: O  Z}) m' a0 G  y! E7 d5 b7 U  B
window.onload=populate
. B0 Y( A* c: W3 V8 f7 ^) ^5 I+ B
6 y3 i& P+ l; C5 T* ~function scrollmarquee(){) B2 F) j. }) v
if (iedom){
' b) ?% @  v1 r5 O, |if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
2 ^. @% k2 l/ \8 M) icross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed( \; L0 Z2 C* C  Y
else
5 Y; n: W4 r3 }+ ucross_marquee.style.left=marqueewidth+8, H" _; u5 v8 A! G7 h  P" A2 m

: _) L3 \  x0 T% n: r+ M1 h8 Z, x}' A/ r3 S1 q0 E1 Q6 m
else if (document.layers){
: |$ v0 o/ L  \! v. S+ c* j3 s, k+ S+ dif (ns_marquee.left>(actualwidth*(-1)+8))9 J- x/ q) B1 G& w+ D1 V
ns_marquee.left-=copyspeed6 c6 E5 X! x- i! N
else# h  Q% E2 X% _6 _3 M  H# s; H
ns_marquee.left=marqueewidth+8
9 v+ t+ v" m# r+ z1 }}
0 i# L& e5 @: V+ y# a/ O}
. G$ @8 K3 N2 [& U! @
* |4 S8 `2 b" Z0 \; }3 qif (iedom||document.layers){
4 {( R# j+ o" B; Z9 xwith (document){
1 ~1 E! N/ n, U. T. |( Jdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')  \/ K7 h) f# D$ d
if (iedom){, C3 J$ ]$ L" Z  g; W2 k7 C3 h) X- ^
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')* z0 H5 o3 y% A& n9 f8 F* p
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
6 Z# o3 m1 S+ r2 Qwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
6 q7 _# G- t: G) Cwrite('</div>')
4 k! j1 `7 @3 u5 B% [% q! |}
& _5 ^1 y, j9 f) u3 H3 Relse if (document.layers){. R( ~$ {2 _3 _" ?6 ~- b/ ~8 I( j
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')6 v+ P: @1 `# k2 v
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
5 C: k: t$ L+ q9 N6 wwrite('</ilayer>')
" Y# b( B  Z# v: V+ _6 B: {}
7 j# u( s# e# [/ a$ ~7 M; Ddocument.write('</td></table>')1 q8 T0 v+ V" V: X" K
}
& o) h9 _9 l3 b1 b$ P& J}' {. G7 k) n, z( B3 x' }4 F. [
</script>

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