Results 1 to 9 of 9

Thread: OnLoad="window.opener.close();"???

  1. #1
    Join Date
    Jan 2006
    Location
    Ft. Smith, AR
    Posts
    795
    Thanks
    57
    Thanked 129 Times in 116 Posts

    Question OnLoad="window.opener.close();"???

    I have a pop up that has a media player in it... and i can get it to open fine... but what i am wanting is for it to close the parent window when it loads without having to click on a link... and also without asking the user if they want to close the parent window. Right now i'm using...

    Code:
    <a href="javascript:opener.close();">Close Previous Window</a>
    Is this possible to put inside of the body tag like an onload function? I'm not getting it... Any help would be appreciated.

  2. #2
    Join Date
    Jan 2006
    Location
    Ft. Smith, AR
    Posts
    795
    Thanks
    57
    Thanked 129 Times in 116 Posts

    Default

    Nevermind... I got it. It wasn't as hard as I thought it was... In case anyone else may ever be wondering how to do it here is the code...

    Code:
    <SCRIPT LANGUAGE="JavaScript">
    		window.open("Muzik.html","newWindow","menubar=no,resizable=no,dependent,status=no,width=350,HEIGHT=390,left=620");
    		window.opener = top;
    		window.close();
    	</SCRIPT>
    That goes inside the head of the parent window... then this goes in the body tag of the parent window...

    Code:
    onload="newWindow()"

  3. #3
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    If I were you, I'd do it from the parent:
    Code:
    <a href="mediaplayer.html" onclick="window.open('mediaplayer.html');window.close();return false;" target="newwindow">Click</a>
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  4. #4
    Join Date
    Jan 2006
    Location
    Ft. Smith, AR
    Posts
    795
    Thanks
    57
    Thanked 129 Times in 116 Posts

    Smile I would too if I could...

    If I were you, I'd do it from the parent:
    Well, I would... but this is for a page on myspace and myspace doesn't allow javascript so I had to use a sort of "Transition" page when they clicked on a link. Thanks anyway though.

  5. #5
    Join Date
    Oct 2005
    Posts
    121
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    what? Twey isnt going to say something about how language is deprecated and to use type instead? (the irony of it is, I just got done reading a thread with a post saying language is deprecated, and to use type instead)

  6. #6
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Because I advised removing the whole tag. I guess I probably should have mentioned it anyway for information purposes.

    Nyne: the language attribute is deprecated. Use type instead:
    Code:
    <script type="text/javascript">
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  7. #7
    Join Date
    Jan 2006
    Location
    Ft. Smith, AR
    Posts
    795
    Thanks
    57
    Thanked 129 Times in 116 Posts

    Default Say What?!?!?!?

    You mean to tell me that by changing the Language attribute to Type I can use it on MySpace????

  8. #8
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Afraid not. Just for future reference as applied to <script> tags.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  9. #9
    Join Date
    Jan 2006
    Location
    Ft. Smith, AR
    Posts
    795
    Thanks
    57
    Thanked 129 Times in 116 Posts

    Default Ok, just checking.

    I guess I misunderstood what you were trying to say. Thanks though.

Bookmarks

Posting Permissions

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