来自Java程序员/Web程序员的帮助 [英] Help from java programmer/Web programmer

查看:78
本文介绍了来自Java程序员/Web程序员的帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要生成一个弹出窗口以显示一些信息.

例如,我有一个名称列表,当我单击它时,我需要那个弹出窗口.
下一个场景是当我单击下一个链接时,第一个弹出窗口应自动关闭,第二个弹出窗口应打开.我该怎么办.

在下面,我发布我的代码.

I need to generate a pop up window to display some information.

As an example i have a name list and when i click on it i need that popup window.
Next scene is when i click on the next link the first pop window should aut o close and second pop up window should open. how can i do that.

Below i post my code.

<script language="javascript" type="text/javascript">
function popitup(url) {
    newwindow=window.open(url,'name','height=200,width=150');
    if (window.focus) {newwindow.focus()}
    return false;
}
</script>
<body>
<a href="a1.html" onclick="return popitup('a1.html')"

    >asdfgh</a>

推荐答案

您好,

我想这就是您想要的(旧弹出窗口已从父级关闭
如果需要新的弹出窗口):

Javascript:

Hi there,

i guess this is what you want (old popup is closed from parent-side
if new popup is desired):

Javascript:

<script type="text/javascript">

      var currentPopup = null;
      function popitup(url)
      {

          if (currentPopup && currentPopup.open && !currentPopup.closed) {
              currentPopup.close();
          }

          currentPopup = window.open(url, ''name'', ''height=200,width=150'');

          if (window.focus)
          {
              currentPopup.focus()
          }
      return false; }

  </script>





HTML:





Html:

 <a href="#" onclick="return popitup(''test.htm'')">Link1</a>
<a href="#" onclick="return popitup(''test.htm'')">Link2</a>


这篇关于来自Java程序员/Web程序员的帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆