返回列表 发帖

网页之跑马灯文字特效

//修改宽度' j1 m) P( `4 ]2 m
var marqueewidth=300
% E0 I# U$ v0 [' I% [4 g3 }) D: K//高度
: B$ h; ^3 }; w/ Q; a) c4 \var marqueeheight=25+ T+ z  {- o% ?! ^: D4 V' [
//速度(1-10)2 w' f* n4 }0 K$ F5 C1 M& F. U
var marqueespeed=3
. w) E/ p' T' O/ @7 H//背景颜色' M0 O+ V" v: |  D! j5 i6 U1 j
var marqueebgcolor="#FFFFFF"" t* k4 R; [0 F9 y9 Y9 E$ @
//是否能暂停 (0=no. 1=yes)?' a7 f2 o( h( J# t  E$ c
var pauseit=19 V# t  a4 j) h9 i

. Z% n/ [& c* \6 |& ^9 m- y//修改显示内容+ R3 {. S5 o0 q. z, t$ O
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'% f! F7 S  ^! m; I8 v6 t% W

7 C" j' V+ C- A9 p& `0 }# L% @) Q9 _* y, V3 W' ^% \
////下面不需改变////////////( y; @4 g) N1 [
# H, l7 I2 Q5 |, {) x( j
var copyspeed=marqueespeed
- A$ V! b. C' y  U) t4 C: ]- Vvar pausespeed=(pauseit==0)? copyspeed: 01 c$ L* B, }) ]( j0 f" G
var iedom=document.all||document.getElementById
$ {5 t" d# t7 G# p; C$ gif (iedom)
! T. U2 j1 `* ~; y7 Kdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')3 _% n( y, C# U$ G- h
var actualwidth=''
* _/ w( l! k0 U; _* |/ `+ \0 Z3 dvar cross_marquee, ns_marquee
2 S2 z; j) t6 d- }8 D% ?4 l/ h8 Y: P2 d4 U$ l4 r! j$ d  G4 x2 t
function populate(){2 H9 l# }* q% \3 N% H, N* Q+ B" S
if (iedom){
$ w& F2 f9 Q- W9 D; w: |cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee5 W- u/ k1 W7 \$ w8 x
cross_marquee.style.left=marqueewidth+86 w3 o( B" V; t$ d7 L+ w$ W
cross_marquee.innerHTML=marqueecontent
4 f8 [. d" @# K9 t; [: Yactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
1 |; V! S8 Z3 G) c& L7 O) W& b, W  O}. F. }% V* w3 e; p  |6 Y$ H
else if (document.layers){. G- m6 H: r1 }( u
ns_marquee=document.ns_marquee.document.ns_marquee2
1 w0 {: J) a+ g1 Dns_marquee.left=marqueewidth+8
& v: w; J/ d9 H$ \ns_marquee.document.write(marqueecontent)% I1 e* M# M0 ]' h% v
ns_marquee.document.close()1 o4 p2 J9 M4 Y( E4 a+ Z. p, h
actualwidth=ns_marquee.document.width
& o7 x* f8 }3 i9 n, T8 d}
* r6 c* u0 d# |9 d/ p* c+ Rlefttime=setInterval("scrollmarquee()",20)
1 o" @; X7 @4 N: l3 f/ S( \. i}5 b# j2 W: H& ^7 w$ j! Z% p* f7 H$ M9 t
window.onload=populate
! ]9 k. ]2 e& X- b( k. K  K6 j0 t. n8 _+ l* Y  @
function scrollmarquee(){( `$ a+ \! l0 x* ^3 T
if (iedom){
' T7 _& y8 s0 _# B- O2 c: zif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
7 g1 V: m4 r, d4 g) |cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed8 I8 X5 w! m9 O" L) \
else! i$ g; N  ?- r- y$ R) Q/ g
cross_marquee.style.left=marqueewidth+8# h2 ~' `7 t+ ~  o

; t% x6 K' i7 A( M- s, j}& H/ U: J9 Z0 Z' R. y
else if (document.layers){
' S  z, c, m( }  e3 ?- ^4 Xif (ns_marquee.left>(actualwidth*(-1)+8))& w$ H0 Y2 Q+ v
ns_marquee.left-=copyspeed
$ p- O/ z$ I' u( }7 T! `else
3 V4 V7 s2 J( Q7 x4 T2 @ns_marquee.left=marqueewidth+8$ M6 y5 ~( {! I6 F
}
& c& d  V, g( K2 p}0 ?! O; C/ e7 X  g3 z
, ~0 Z7 t. N  c1 K1 I6 d% A
if (iedom||document.layers){
9 }- S/ b: D5 Hwith (document){4 c; i& X$ [0 J9 a9 U3 t$ \
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')# E) A: d: t( T/ A9 ^
if (iedom){9 k5 L- i% U  X. H* M8 J
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">'): P( p4 ~" @8 S! ~
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
+ `9 ]. }- x' {/ K. D# S5 g( u0 Fwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')" l4 @1 ?: W7 V: B, @/ b! _7 k
write('</div>')# D1 p! N* J' j0 g* e6 f& m
}) S! d, y' E! K: n! R6 n9 y
else if (document.layers){" U% m& t- Z; y) ]
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
9 k" L% q3 [: Qwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')# x" w8 _$ a% |
write('</ilayer>')
0 s& q( k" N$ W. U* K* h6 @( R* g' U}+ l8 H0 U- l6 E- a0 K
document.write('</td></table>')- @& G7 q- [* W+ \9 b# s
}
9 a2 e# {+ b3 f& k}
. R0 j% N4 ]& O- g( O</script>

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