网页浮动窗口代码怎么写-广州新希望电脑学校

  网页浮动窗口代码怎么写-广州新希望电脑学校
  在这个特效中,有一个浮动的窗口,飞动片刻后会自动消失。可用于新消息在小窗口中的公布,为了方便浏览者,窗口会自动消失。

  第一步,将下面的代码加入到<head>与</head>之间:
  <script>
  <!一
  var flyingwin
  var popupwidth=200
  var popupheight=150
  var marginright
  var windowcenter
  var ise top=200
  var ileft=-popupwidth-50
  var step=40
  var timer
  var waitingtime=3000
  var pause=20
  function showWindowQ{
  flyingwin
  window.open("",
  "flyingwin"
  "toolbar=no,width=',十popupwidth十",height=”十popupheight+",top=100,left="+(-popupwidth)+"");
  flyingwin.document.openO;
  flyingwin.document.write("<html><title>漂浮的窗口</title><body bgcolor=ffffff
  text= #006600><p align=center><br><font size='+1'><b>漂浮的窗口!</b></font><br>这个窗口
  不会打扰你很长时间.它很快就会飞走并消失。</p></body></html>");
  flyingwin.document.close();
  if (document.all)王
  marginright=screen.width+50
  }
  if (document.layers){
  marginright=screen.width+50
  }
  windowcenter=Math.floor(marginright/2)-Math.floor(popupwidth/2)
  movewindowO
  }
  function movewindow({
  if (i_ left<windowcenter){
  flyingwin.moveTo(i left,ies top)
  i left+=step
  timer-- setTimeout("movewindow()",pause)
  }
  else毛
  clearTimeout(timer)
  timer- setTimeout("movewindow2Q",waitingtime)
  }
  }
  function movewindow2Q{
  if (i_ left<=marginright){
  flyingwin.moveTo(i left,iestop)
  i left+=step
  timer= setTimeout("movewindow2()",pause)
  }
  else{
  clearTimeout(timer)
  flyingwin.close()
  }
  }
  第二步:将下面部分加入<body>标签:
  <body onload=showWindow()>

更多关注:广州新希望电脑学校

12 12 分享:

相关课程

发表评论

登录后才能评论,请登录后发表评论...
提交评论

最新文章