返回列表 发帖

网页之跑马灯文字特效

//修改宽度3 [: H7 }6 P& e$ {
var marqueewidth=300
# j! X4 S3 d6 _- E1 e//高度
' Z" u1 o. d. B% rvar marqueeheight=253 i2 }; V5 _1 J
//速度(1-10)" a6 }- J. Z  Y# o0 e
var marqueespeed=3! E0 w6 x6 o/ v- v! C( L2 [) T
//背景颜色
' c/ [# h6 `% L' n5 G$ Qvar marqueebgcolor="#FFFFFF"6 o$ y9 q$ }* n5 K
//是否能暂停 (0=no. 1=yes)?. u( v0 c! E! D" ?! }
var pauseit=14 T/ i7 r0 R. v0 M$ d& y
9 x4 I9 R8 Y- o/ o5 R$ ^
//修改显示内容
0 m( f5 U5 R3 {5 [var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'9 r9 N7 m8 k0 G
; I( l( O& T. I  [5 I+ i! R: H9 ~

: F- N9 R. Y" V////下面不需改变////////////  m7 w' x5 d9 q2 ?+ m4 O" p

4 j* F) r4 f7 V6 \2 \3 i/ Ovar copyspeed=marqueespeed5 h  J) N8 F9 X; b% f
var pausespeed=(pauseit==0)? copyspeed: 0
1 V9 j, U5 e1 {1 C( Uvar iedom=document.all||document.getElementById
! G% h. m% d1 Z1 ]: t( ?$ {2 lif (iedom)
. J5 L, ~" u& s, ^. Xdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')+ W0 y2 T; Q4 S& y, P
var actualwidth=''* F) P& J5 w1 l1 u+ d2 U
var cross_marquee, ns_marquee$ o7 ]/ S) q2 `" Q& v  I) Y* U9 K

$ ~- S+ K) H9 ^- L0 Pfunction populate(){' F+ e4 Q5 l: }2 |
if (iedom){
- v1 F  S+ m8 U. Q* i' M2 c; g1 Lcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
. g( \* ?' v8 W+ F, g4 rcross_marquee.style.left=marqueewidth+8, b, U% r$ m! a2 h
cross_marquee.innerHTML=marqueecontent6 Y8 ^/ R- r2 Z6 O  x/ E5 h* F
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth$ p, [( B1 l4 t& D+ |9 q
}
+ L1 h+ K# T, u' U- Felse if (document.layers){. C% m3 X6 ^2 x; b* T, w
ns_marquee=document.ns_marquee.document.ns_marquee2; _1 W1 C8 ~; W9 @' p9 I
ns_marquee.left=marqueewidth+8
% v4 g" l5 N8 R* x0 J1 ons_marquee.document.write(marqueecontent)
. u8 f3 ^- n& e' X; \/ }2 {  qns_marquee.document.close()
# [) J6 v1 C& [; }actualwidth=ns_marquee.document.width
9 ~) v4 {9 T# x3 K9 Z7 u4 M}
5 h) E" U* o; `6 B: m1 S; k" N3 l0 g  A* Clefttime=setInterval("scrollmarquee()",20)
  ~4 \2 o0 N2 j" H& V' j% X5 M}
) j/ X$ t+ \7 E# f! p' lwindow.onload=populate( _8 a% N. @% o9 c
$ U, M; [' L0 i4 r9 b' r* r2 W
function scrollmarquee(){
  h* S# J+ J" Q1 m( t% {; oif (iedom){
) j  n5 i& o! ]% eif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
9 k4 i: I6 H$ ocross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
; T- {' q3 B' i$ c3 {3 pelse
3 L) h; `2 o  p( Z1 O$ O. Pcross_marquee.style.left=marqueewidth+8) ~- ]; Y0 ~1 Q

8 e! a$ o2 i1 s) _}- U: F2 ?( i+ l% ]7 L7 v  n# D$ w
else if (document.layers){( [5 b0 ]& l1 K( t6 ?8 \" o
if (ns_marquee.left>(actualwidth*(-1)+8))4 R2 Q- t8 {4 p5 U
ns_marquee.left-=copyspeed
) y0 b: W; m/ xelse/ `" {% m! s3 O5 S
ns_marquee.left=marqueewidth+8
! i  x1 q1 F' H}. H( w, F) l( R' e; U
}
- o* P# f+ m# i! q- `- k4 [
$ e# _1 u+ Y% |& d, hif (iedom||document.layers){
. }/ Q% Z) v! f& I" @with (document){' L9 ]9 e& S- o+ `
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
& [: c$ @4 c' cif (iedom){! `2 d& o4 p& ]# b& ]
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
! q0 w* P% [- |/ T- c: j2 r# }! lwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')' Z9 w' e% N( w; K( G0 p: A/ O
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')8 j5 N: _1 o6 X
write('</div>')
& T2 K0 Q+ R* |1 G9 `}: s- c9 c+ e4 ^$ |# g5 r7 d5 m
else if (document.layers){
+ T# }, k( ?3 v& }6 K! J$ Vwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
  Z8 N  B. q' z# d$ Dwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')+ G' }% w( m3 `. F! i7 `; f& Q
write('</ilayer>')' v. U# a# X4 {5 P4 W
}
' C  {0 A8 s1 T6 y/ kdocument.write('</td></table>')
" _% j' j/ G" t}
( X; j7 M% y, x' J# _$ u* N}$ N# a6 c7 `1 U) K+ b) ~
</script>

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