返回列表 发帖

网页之跑马灯文字特效

//修改宽度
, Z, F- S- R% i9 Zvar marqueewidth=3008 [" |# Q/ M7 G3 C0 R! \' y, D+ G
//高度2 d2 g5 g3 V) r
var marqueeheight=25, g, [0 k8 S5 N
//速度(1-10)
0 c% x) J: i2 A  r- z6 u" svar marqueespeed=3
6 g/ L* t9 P6 E* O) r- Z2 t4 h//背景颜色# q$ z2 c4 I" X8 W& r, v" T6 {
var marqueebgcolor="#FFFFFF"8 X; R- j2 Q  T) ?" s% \. o
//是否能暂停 (0=no. 1=yes)?
3 t& Q' G% V4 t6 s  q+ @3 Z4 w$ |var pauseit=12 O. Z) [* W$ k( Y
; x4 Z7 l* |% _2 Z
//修改显示内容9 U/ Q9 y/ h" a0 k, r4 K+ V& [7 y/ r7 d+ R
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'0 E7 r4 e& @7 ^  X7 ~6 A
2 Y% u2 N, F: s0 c5 D" |* [
! _# Z4 W* Y  r: g2 K- h) e7 H+ _; T
////下面不需改变////////////
! a5 h, q0 E; O! x) G* c+ d/ C$ H2 d$ q& \, }! j+ }9 |- g* W$ V6 S
var copyspeed=marqueespeed6 E& ~$ u# v/ H8 G; J
var pausespeed=(pauseit==0)? copyspeed: 02 G* j9 {9 S( g
var iedom=document.all||document.getElementById4 V3 u, b& q& u& X% D
if (iedom)
( I: q; k7 Z3 r. B2 Y4 P5 j: O4 f6 wdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')* D, H4 a# U  {( g& q' E" p+ E' R
var actualwidth=''% S3 U+ f$ x( ]% I. S1 N
var cross_marquee, ns_marquee1 P3 B( u) v& F! e( d2 h( i9 e
2 V3 w3 y- J* g  U8 X0 z# C
function populate(){* t/ A5 I3 X: L+ K- s9 Z# f
if (iedom){
3 ?2 r9 m. }& O$ K+ ^: R* L8 u. }$ kcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
! D6 n' ?/ p! X* ?) ~# o9 |- scross_marquee.style.left=marqueewidth+8# y' T" P( O+ J# j
cross_marquee.innerHTML=marqueecontent
  d* U: o, k: l! c) G+ B, Lactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth6 V  g3 ]0 \6 h! I7 N) u! m5 S: I
}
2 j' u& _# a0 l5 W1 Belse if (document.layers){7 b$ s, W) q6 J6 h) F' x
ns_marquee=document.ns_marquee.document.ns_marquee2! I9 ]6 ^+ g& g% G$ |9 u' d
ns_marquee.left=marqueewidth+8
% h) T1 ]7 e( ?" \ns_marquee.document.write(marqueecontent)
/ f/ ?& U. M) O9 c, M1 fns_marquee.document.close()
$ ~2 P6 J" e6 U& `2 M9 wactualwidth=ns_marquee.document.width
9 w( F) {2 g; Q; |$ ~}
; X+ t* }4 g  B( ulefttime=setInterval("scrollmarquee()",20)
0 Y3 K# ?; O6 J1 [/ I# t}5 j- U/ i0 |9 H
window.onload=populate0 O# w: {6 B; w# c2 ]2 E2 n, h
/ D8 I4 F- |0 g& l! N; {
function scrollmarquee(){
, k/ c+ h% X/ B+ S/ ]if (iedom){7 E" |5 ^- h0 z) X
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))" T- @5 j! o; ~/ A* T0 v
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
' D3 J! F8 G! V) X+ J  h9 D7 G, Felse
) P/ N* W: u. {. ^' d* B0 B/ Pcross_marquee.style.left=marqueewidth+82 k6 M: v5 W5 ]/ M' E9 ?! n2 K" e1 R4 |
5 H( K7 e/ b! ~/ E% L* |
}3 [2 n9 L4 J0 R! [
else if (document.layers){# n7 r. e- e; }1 _* @
if (ns_marquee.left>(actualwidth*(-1)+8))
2 i7 P( w7 d* n9 o4 C# D9 _ns_marquee.left-=copyspeed% f' `3 U" h% @' e* @
else
' i6 v8 G, `, g, ^0 j5 @ns_marquee.left=marqueewidth+8
2 w5 z  c' q. B! e}
- ]! M7 g2 m2 b2 y5 z) s* A# @}
( A* r0 |  M" v. ]7 a7 h7 ]& q6 T' `7 u  \' d7 G
if (iedom||document.layers){
% M8 v( [& r3 @with (document){
$ N, T0 ^  j/ e% Ddocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
2 ]8 z' k, }5 |& P/ F/ F6 q5 O. Uif (iedom){
8 w+ U) w& M. E& k. L/ O7 twrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
3 Z! _+ M& @* q% fwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
( p; W8 u! w* v1 A$ nwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
, A3 w9 S2 _- swrite('</div>')
# b' [, z* D- R/ k' n3 L}
  F& v, Y& W: \9 F5 d* l- x4 Felse if (document.layers){
/ W1 ]  F* _" p" M& n5 D/ T. xwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')0 ~0 U3 v% c8 y; }( @& U7 {! d9 M
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')0 h0 t  c8 n. c+ Q
write('</ilayer>')1 H4 \% R4 g' ^& M% t; L
}" u: [0 E6 W) B1 @% K* V' K
document.write('</td></table>')
; O7 Z: t7 d. N6 S  H}
3 G9 U4 b, ?/ D9 ^6 r' w}
2 `* C; G& r! j$ ?" D</script>

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