Results 1 to 4 of 4

Thread: Popup Window comes out as whole window

  1. #1
    Join Date
    May 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Popup Window comes out as whole window

    I'm trying to send submitted information that has been validated via javascript onto a popup window. However the popup becomes a whole window.

    I'm new to javascript and still learning the ropes. Please provide any assistance and feel free to provide advice and modifications to the code.

    Thanks.
    ---------------------

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <head>
    <title> New Document </title>
    <script type="text/javascript" language="JavaScript">
    <!--
    function checkContents(theForm)
    {
    if (theForm.name.value == "")
    {
    alert("Please enter a name.");
    }
    else if (theForm.weight.value == "")
    {
    alert("Please assign a weight.");
    }
    else
    {
    theForm.submit();
    }
    }

    function popWindow(wName){
    features =

    'width=400,height=400,toolbar=no,location=no,directories=no,menubar=no,scrollbars=no,copyhistory=no,r

    esizable=no';
    pop = window.open('',wName,features);
    if(pop.focus){ pop.focus(); }
    return true;
    }
    -->
    </script>
    </head>

    <body>
    <form name="edititem" action="popup2.php" method="post" target="Details" onSubmit="return

    popWindow(this.target)">
    <input type="hidden" name ="weight" value="172">
    <input type="hidden" name="name" value="John">
    <!--<input type="submit" value="John">-->

    <input type="button" value="Edit Item" onClick="checkContents(edititem)">
    </form>

    </body>
    </html>

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

    Default

    However the popup becomes a whole window.
    As opposed to a healthy and nutritious dinner?
    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!

  3. #3
    Join Date
    May 2006
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I was hoping that the popup would be just a popup window with the settings in the javascript function, ie. a smaller sized window without the menu, etc.

    what's happening is that the new window covers the old one entirely. i was hoping for a smaller window where the user can edit the data and upon submission, the data will update the info on the main(original page) and reload the info with what was edited.

    thanks.

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

    Default

    Well, you haven't escaped the linebreaks in the features variable. Try removing them.
    Also, all variables should be declared using the "var" keyword, to avoid them being unnecessarily global.
    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!

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
  •