SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2000
    0 Post(s)
    0 Thread(s)
    I am in need of some JavaScript experts help here. I have looked all over the net and have not found what I am looking for.
    I am building pop-ups using the'Etc','Etc',heigth, etc, etc,); function or new object call. The popups are linked to urls like so

    blah blah blah <a href = '#' onClick = new_win_function_call();>blah blah.

    Now I record what XY position the mouse was in when the link was clicked and I then write out the new window out in that position. So it writes a popup window based on where it was clicked. If a new link is clicked I close the window and start the process again of finding the position the mouse and drawing a new window.

    This is working well in most browsers. I have been asked to add some functionality which is the subject of my question. Once the pop up is drawn and a user moves it can I some how figure out if the window has been moved? Then when the user clicks on a new word not redraw the window based on the mouse click but on where the window was moved to previously?

    I know there is an onmove handler in netscape but I need to work in "of course" most browsers. And I have not been able to get the onmove handler to work anyway. Any help would be greatly apprecatied, I have been on this one for a while.


  2. #2
    SitePoint Member
    Join Date
    Apr 2001
    0 Post(s)
    0 Thread(s)
    Hi Brett,

    I don't really have time to knock up a script for you but hopefully the following info will help you to do it yourself:

    There is a window.onMove event handler, but the last time I checked it was only supported by NS4. To use it in NS4 you would need to have a function in which you first open your pup-up and then use setTimeout to attribute the event handler. Something like this:

    function openPopUp(){
      popUpObj =;
      setTimeout("popUpObj.onMove=calcPopUpCoords()", 500);
    The setTimeout is used to give the window time to open before assinging it with an event handler. Without it an error will occure.

    Of course NS4 doesn't have the major slice of the browser market, so this isn't a great deal of help. There is a work around for this problem however. It would go something along the lines of replacing the contents of the setTimeout with a function that repeatedly checks for the popop's coordinates. You may also need to check for the existance of the popup in that function.

    Hope that helps.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts