i only need this to work in i.e. and im sure it does but i am getting a "closed is null or not an object" exception message

declared in HEAD::

<script type="text/javascript">
  function reloadwin(w){
    if (w.closed) alert('window is closed')
    else return setTimeout('reloadwin()', 500)
  }
</script>

called in BODY

<script language='javascript'>reloadwin(w)</script>

Recommended Answers

All 6 Replies

i only need this to work in i.e. and im sure it does but i am getting a "closed is null or not an object" exception message

declared in HEAD::

<script type="text/javascript">
  function reloadwin(w){
    if (w.closed) alert('window is closed')
    else return setTimeout('reloadwin()', 500)
  }
</script>

called in BODY

<script language='javascript'>reloadwin(w)</script>

and sorry i call the window using this

<script language='javascript'>
  w=window.open('CIPFATree.aspx', 'CIPFA', 
  'width=360, height=160, status=yes, menubar=no, resizable=yes,
  'scrollbars=yes');
</script>

You need to post the entire code as it is for someone to help you out. Posting in bits and pieces would just make it difficult.

And BTW, that kind of error is normally given when the variable 'w' doesn't refer to any window, i.e. function is called before window is created.

very sorry. here we go.

<HTML>
  <HEAD>
  <script type="text/javascript">
    function reloadwin(w){
      if (w.closed) alert('window is closed')
      else return setTimeout('reloadwin()', 500)
    }
  </script>
  </HEAD>
  <BODY>
    <script language='javascript'>
      w=window.open('CIPFATree.aspx', 'CIPFA', 
          'width=360, height=160, status=yes, 
          menubar=no, resizable=yes,
          'scrollbars=yes');
      reloadwin(w);
</script>
  </BODY>
</HTML>

You forgot to pass 'w' to the function passed in the setTimeout().

i love you

Happy coding. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.