mardi 25 août 2015

Checkbox Html Java Script

I need to reload a page when a checkbook is clicked. If the checkbox was unchecked before clicking then it should be checked after the page reloads. If the checkbox was checked then after clicking the page should reload and the checkbox should be unchecked.

Moreover, I need to pull the information (if is checked or unchecked) from the checkbox to change my page accordingly.

How can I reload the page and pass this values changing this function? I am complete noob so please try to stay simple. Ty.

      echo '<input id="check_mostra_email" type="checkbox" value="mostra_email" onclick="reloadPage()"/>';  

      echo '<script type="text/javascript">
        <!--
           function reloadPage()
           {
              if(document.getElementById("check_mostra_email").checked === true){
                document.forms["RelatorioGerencialCarteiras007"].submit();
                }

              else{
                document.forms["RelatorioGerencialCarteiras007"].submit();
                } 
           }
        //-->
     </script>'; 




Aucun commentaire:

Enregistrer un commentaire