2 Replies Latest reply on Oct 26, 2006 5:47 PM by jamesy

    which does this not work within a frame

    jamesy
      in a window without frames, the following javascript works like a charm in a little CMS I've built for a customer...

      Xwidth=window.document.body.offsetWidth-event.clientX
      YHeight=event.clientY
      if(Xwidth<=30&&YHeight<0)
      {
      // alert("closed2")
      window.location.href="pop_chat_main_logout.asp";
      window.close();

      }

      It basically performs some additional actions after the "x" button is clicked if they close the window without using the dedicated "logoff" button I've provided.

      I know it's a bit of a dirty method but it does work for my customer.

      So, if I have a second window but this one is made up of a frameset and several frames I can't get it to work.

      I've tried placing the code on the frameset page itself, and also in one of the frame, at the same time changing it to look like:

      Xwidth=top.window.document.body.offsetWidth-event.clientX
      YHeight=event.clientY
      if(Xwidth<=30&&YHeight<0)
      {
      // alert("closed2")
      top.location.href="pop_chat_main_logout.asp";
      top.close();

      }

      but it still doesn't work.

      Any ideas?
        • 1. Re: which does this not work within a frame
          Level 7
          > So, if I have a second window but this one is made up of a frameset and
          > several frames I can't get it to work.

          Honestly, this sounds like a nightmare of an interface. Why are you using
          Frames?

          Anyways, your javascript it following the DOM starting at the 'window'
          level. Remember that when you use frames, you are adding a layer to the DOM
          and need to adjust your scripts accordingly.

          -Darrel



          • 2. Re: which does this not work within a frame
            jamesy Level 1
            Yes I am aware of that. which is why I I've been changing it to be top.window etc etc but it hasn't worked.

            This "nightmare" of an interface is working pretty well except for this issue.

            In fact, this issue is actually caught by a Stored Procedure in the SQL database that runs part of it, but if I could get this working it would be helpful.


            All that I'm looking to do is get the above working.. so please refrain from comments about the nature of the interface when a) you haven't even seen it b) you haven't even used it and c) don't know the situation in which it is being used.