SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Dec 2004
    Location
    Freo
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Can someone show me the code so I can get this form to open a new window.

    Can someone show me the code so I can get this form to open a new window.

    What I need it to do is when the checkbox is checked the user then submits the form. But a new window only appears if they have checked the box.

    can this be done with JS or will i have to use cookies?

    thanks for your time :0)

    <form action="submit.php" method="post" name="form1" id="form1">
    <table width="90%" align="center">
    <tr valign="baseline">
    <td nowrap="nowrap" class="smalltext"><input name="checkbox" type="checkbox" id="freq_member"/></td>
    </tr>
    <tr valign="baseline">
    <td align="right" nowrap="nowrap" class="smalltext"><input name="submit" type="submit" value="Submit" />
    <input type="reset" name="Reset" value="Reset" /></td>
    </tr>
    </table>
    </form>

  2. #2
    SitePoint Wizard
    Join Date
    Mar 2001
    Posts
    3,537
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    1) Put on onsubmit event handler in the form tag.
    2) Call a function from the onsubmit event handler named, say, onsubmitFunc()
    3) In the onsubmitFunc(), check to see if the checkbox is checked:

    if(document.getElementById("myCheckboxID").checked == true)

    That requires that you put an id attribute in the checkbox.

    4) Open the window if the checkbox is checked:

    window.open(....);


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
  •