返回列表 发帖

网页之跑马灯文字特效

//修改宽度  u. z* U2 Q9 s8 G$ a# `' P
var marqueewidth=3007 s7 w" \4 D/ R5 s  J2 ^; [: K
//高度
7 }/ v) R% @# evar marqueeheight=25
. P+ V! `! E3 Z9 {//速度(1-10)
" J7 |! n; B, j9 |7 q8 wvar marqueespeed=3
" {0 N: [4 W+ q5 v8 Y) G6 t3 D//背景颜色  j% m5 I3 g. G5 Y& I3 n7 C  ?
var marqueebgcolor="#FFFFFF"
& s) f9 I3 S! t& c# J- P//是否能暂停 (0=no. 1=yes)?
) I; J3 Y* |! f9 b: Nvar pauseit=1: G6 _4 f% W$ X
6 p" q% B! z8 n7 A# z+ d) B3 @
//修改显示内容( i. V/ U  W& }! X. E+ |" K. b
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
. ^# r: F5 R0 G6 `/ y
) i2 c. _5 ]* x( f/ C
- W3 j! e7 A" z& ~; \) g7 @8 K////下面不需改变////////////
5 i$ p% J9 t& R% L( h0 O  w' e6 u
* T( s9 Z$ C2 W: e' K" M( yvar copyspeed=marqueespeed
8 j7 b8 `4 |6 o1 I) Evar pausespeed=(pauseit==0)? copyspeed: 0
, `9 S# f, x$ \) qvar iedom=document.all||document.getElementById
) B; E- K+ u9 a" ?% u9 d8 ]) ?if (iedom)% H; J0 @5 n) Y7 E0 ]1 x8 R
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
1 B0 C# b" U* t, R$ i  N' n7 Gvar actualwidth='') ^9 o4 d  l# ^& H3 }
var cross_marquee, ns_marquee
, i  {2 f( U8 K" Y6 n- V" n. z1 S5 i- V
function populate(){
8 X( Y$ e1 c7 f3 Pif (iedom){. d1 D, I& G& m7 R9 ]( F
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
8 X) _- `2 x& I5 `, ~* @& m) A3 _cross_marquee.style.left=marqueewidth+8
7 W. }* ]/ n  r9 P8 d) |cross_marquee.innerHTML=marqueecontent  Z6 s, g$ y6 A& u+ A
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth  C; d+ H0 v( U' ^
}
+ g3 l2 [6 c# x- melse if (document.layers){0 v9 G) U0 f3 r  S; k3 V) w
ns_marquee=document.ns_marquee.document.ns_marquee2! X) I8 u& m! n+ `& z$ q
ns_marquee.left=marqueewidth+8
  |6 L  n8 p3 O5 M) ]2 K4 L" Kns_marquee.document.write(marqueecontent)- ?/ l3 c% y; @2 b
ns_marquee.document.close()
' w; o$ m+ m8 J6 ^$ R+ u, ~actualwidth=ns_marquee.document.width
' `7 L6 g' D6 A$ _0 U& K3 h4 W- o7 v}
- G7 Q/ }( u- l! a6 i& b/ Wlefttime=setInterval("scrollmarquee()",20)
% t! N! ^( h% N5 I  ]}
1 X; X7 V4 ~" C: w' ]) n) |window.onload=populate! u. U/ i% m5 ]0 l4 F
- r$ j% b$ F# d9 l
function scrollmarquee(){& B4 H0 H6 R4 m& `# }, u1 S
if (iedom){! [3 _; w% K3 U
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
7 [9 \7 }0 L/ ]cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
2 h  k8 f2 o7 F( w- L5 c- _# oelse  s) M7 E/ c7 f) P9 z: l
cross_marquee.style.left=marqueewidth+85 P. F; z9 U# p% m; N

7 I7 B  i0 `1 |& V" o) ~0 z& |}1 |& i' _/ ^+ ?" w
else if (document.layers){3 o5 a1 ~+ z; D9 z; w" S! F
if (ns_marquee.left>(actualwidth*(-1)+8))
  V; E& `6 M, ]- M4 b. [ns_marquee.left-=copyspeed, ]) u5 k5 [7 {4 D5 V0 C6 y( G0 z8 v
else
' B3 \+ V6 N4 T" x4 t' x7 \- gns_marquee.left=marqueewidth+89 h2 O# H" ~4 T$ h
}' e# [' h8 e$ a5 z  c
}
( p- @1 l) b9 I3 M% N2 I( X. z- V7 Y
if (iedom||document.layers){
, I' _# k- b& q! R5 J/ owith (document){
1 }& I# j, \7 J/ n2 T. _2 ]document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 [* o) h# M0 u. T1 Y, M' X- q
if (iedom){( `& e* I0 f9 S6 Q" ]) q3 u5 N, D
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')- G8 p3 J: e) F( D: _  B
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
: K* c( o7 I% @write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')$ R# g: x" C7 ?0 J. h! ^3 o4 @
write('</div>')- D- N4 O' c: f" U2 D9 I: o: E. m' b2 e
}
6 d$ K1 k6 K0 x, K# jelse if (document.layers){
+ H( Z5 p$ b2 i- Awrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')9 O% `. d6 v" B8 ]1 `8 {+ |
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')9 C1 T7 l  m/ g$ P
write('</ilayer>')
( Y0 r7 r/ q' A6 L}
9 I7 Y3 z" Z! Pdocument.write('</td></table>')
8 W4 }: |( P& @  Q' z  Z% Z5 D}1 \( v3 i- H+ J
}  n/ g7 ~- a+ d+ y0 Q5 D, S
</script>

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