Results 1 to 9 of 9

Thread: window.close() & modal windows

  1. #1

    Thread Starter
    Frenzied Member msimmons's Avatar
    Join Date
    Jul 2001
    Location
    Houston, TX
    Posts
    1,057

    window.close() & modal windows

    I have a modal window that I would like to close with the window.close() method. But it seems to open a new window instead,,, any suggestions. Maybe I just need to give up on the modal widnows because I can't seem to get them to work.
    Michael

  2. #2
    Hyperactive Member progressive's Avatar
    Join Date
    Sep 2001
    Location
    Manchester, UK
    Posts
    404
    post your code and i'll sort it for you!!

  3. #3

    Thread Starter
    Frenzied Member msimmons's Avatar
    Join Date
    Jul 2001
    Location
    Houston, TX
    Posts
    1,057
    in the parent window I open the chile in a function like this:
    Code:
    function openthechild() {
    	var intWidth = document.body.offsetWidth / 2 - 225;
    	var intHeight = document.body.offsetHeight / 2 - 200;
    	taiWin = showModalDialog("test.asp", "TAI",
     "status:no;resizable:no;help:no;scrollbars:no;dialogwidth:455px;dialogheight:360px, left:' + intWidth + ' top:' + intHeight + ');"); 
    }
    and this is the child's full code:
    Code:
    <HTML>
    <HEAD>
    <TITLE></TITLE>
    </HEAD>
    <BODY>
    <a href="javascript:window.close()">Click Me</a>
    </BODY>
    </HTML>
    all i want it to do at this point is close, then I will work on all my other problems But for now when you click on the 'click me' link it just makes the screen 'blink' like a new window was opened and closed really fast.
    thanks in advance,
    Michael

  4. #4
    Hyperactive Member progressive's Avatar
    Join Date
    Sep 2001
    Location
    Manchester, UK
    Posts
    404
    Try getting rid of the space in JavaScript

    Code:
    <a href="java script:window.close()">Click Me</a>
    should be

    Code:
    <a href="javascript:window.close()">Click Me</a>

  5. #5

    Thread Starter
    Frenzied Member msimmons's Avatar
    Join Date
    Jul 2001
    Location
    Houston, TX
    Posts
    1,057
    its not really there... vbforums adds that so we cant do anything bad. I noticed it once in another post.
    Michael

  6. #6
    Hyperactive Member progressive's Avatar
    Join Date
    Sep 2001
    Location
    Manchester, UK
    Posts
    404
    or maybe not seeing as the forum put that space in...LMAO

  7. #7
    Hyperactive Member progressive's Avatar
    Join Date
    Sep 2001
    Location
    Manchester, UK
    Posts
    404
    Hmm strange that I get the same effect.

    I've never used showModalDialog before, I'll have a play with this over the weekend!

    It'll be monday when I get back to you I'm afraid Have a good weekend M8

  8. #8

    Thread Starter
    Frenzied Member msimmons's Avatar
    Join Date
    Jul 2001
    Location
    Houston, TX
    Posts
    1,057
    I tried using the modal before on anoher app and wound up scraping it cos modal window didn't like what I was doing so I used a open.window made it chromeless, built chrome, and had a function to keep it on top... I'll probably have to do that all again.
    Michael

  9. #9
    Hyperactive Member progressive's Avatar
    Join Date
    Sep 2001
    Location
    Manchester, UK
    Posts
    404
    I've got a solution for you M8,

    instead of using

    Code:
    <a href="javascript:window.close()">close me</a>
    use :

    Code:
    <a href="#" onclick="window.close()">close me</a>
    This solution worked on my test page! let me know how you get on!

Posting Permissions

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



Click Here to Expand Forum to Full Width