Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    New to the CF scene
    Join Date
    Jul 2004
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question checkbox with innerHTML

    Hi!

    I made this script but always that submit is done all checkbox in the page are erased. My question is, how make submit, without that checkbox are erased from the page ?

    JS script:
    ----------

    <script language="JavaScript" type="text/javascript">
    <!--
    function checkForm()
    {
    if (document.addcheck.info.value == "") {
    document.addcheck.info.focus();
    return false;
    } else {
    elem = document.getElementById('checkID');
    elem.innerHTML = elem.innerHTML + "<input type='checkbox' name'check[]' value='+ document.addcheck.info.value +'>" + document.addcheck.info.value + "<br>";
    return true;
    }
    }
    //-->
    </script>

    PHP file:
    ----------

    ...

    <?
    echo "
    <form method=\"post\" action=\"addcheck.php\" name=\"addcheck\">
    <input type=\"text\" name=\"info\">
    <input type=\"submit\" name=\"anexar\" value=\"Anexar\" onClick=\"checkForm();\"><br><br>
    <div id=\"checkID\"></div>
    </form>";
    ?>

    ...

    Tks for the help!
    Last edited by Oompi; 07-08-2004 at 03:49 AM.


 

Posting Permissions

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