Javascript Not Working on PHP page -


i'm trying code checkbox must checked in order "submit" button on form enabled. first tried using linked file no avail; inserting script doesn't seem work. can help? entire code page posted below. in advance!

<!doctype html public "-//w3c//dtd xhtml 1.0 strict//en"      "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head>     <meta http-equiv="content-type" content="text/html; charset=utf-8" />       <link rel="stylesheet" type="text/css" href="stylesheet.css" />     <script type="text/javascript" src="includes/imagetransition.js"></script>     <script type="text/javascript" src="includes/checkenabledisable.js"></script>     <script type="text/javascript">         var checker = document.getelementbyid('acknowledgment');         var sendbtn = document.getelementbyid('submitmessage');         // when unchecked or checked, run function         checker.onchange = function(){             if(this.checked){                 sendbtn.disabled = false;             } else {                 sendbtn.disabled = true;             }         }        </script>     <title>contact us</title>   </head>  <body>   <div class="page-wrapper"> <div id="header">  <img src="images/img1.jpg" name="slideshow" width="70%" height="200" alt="headerimage.gif"><br> <a href="javascript:chgimg(-1)">previous</a> &nbsp;|&nbsp; <a href="javascript:auto()">auto/stop</a> &nbsp;|&nbsp; <a href="javascript:chgimg(1)">next</a></div>  <br><br>  <aside class="sidebar">         <div id="vmenu">             <ul>                 <li class="sideli"><a href="main.html.php">home</a></li>                 <li class="sideli"><a href="areas.html.php">areas</a></li>                 <li class="sideli"><a href="profiles.html.php">profiles</a></li>                 <li class="sideli"><a href="contactus.html.php">contact us</a></li>             </ul>           </div>      </aside>     <section class="main">         review submission , contact you, within 72 hours.</p>         <form action="actionemail.php" method="post">             <table class="emailtable">             <tr><td><label for="name" class="emaillabel">name: </label></td><td><input type="text" name="fullname" size="50" value="name" style="width: 290px;" /></td></tr>             <tr><td><label for="phone" class="emaillabel">phone: </label></td><td><input type="text" name="phone" size="20" value="phone" style="width: 290px;" /></td></tr>             <tr><td><label for="email" class="emaillabel">email: </label></td><td><input type="text" name="email" size="50" value="email" style="width: 290px;" /></td></tr>             <tr><td><label for="comment" class="emaillabel">issue: </label></td><td><textarea rows="3" cols="26" name="comment" value="tell more" style="width: 290px; height: 55px"></textarea></td></tr>             </table><br>             <input id="acknowledgment" type="checkbox" name="acknowledgment" value="1" /><label for="acknowledgment">i acknowledge there may delay in responding request.</label><br>         <br><input id="submitmessage" type="submit" name ="submitmessage" value="send email" disabled />         </form>     </section> </div> </body> </html> 

your function not "listening" onchange event.

use instead. notice changed checkbox have onclick event.

<!doctype html public "-//w3c//dtd xhtml 1.0 strict//en"      "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head>     <meta http-equiv="content-type" content="text/html; charset=utf-8" />       <link rel="stylesheet" type="text/css" href="stylesheet.css" />     <script type="text/javascript" src="includes/imagetransition.js"></script>     <script type="text/javascript" src="includes/checkenabledisable.js"></script>     <script type="text/javascript">      function enablesubmitbutton() {          if (document.getelementbyid("acknowledgment").checked == true)             document.getelementbyid("submitmessage").disabled = false;     }      </script>     <title>contact us</title>   </head>  <body>   <div class="page-wrapper"> <div id="header">  <img src="images/img1.jpg" name="slideshow" width="70%" height="200" alt="headerimage.gif"><br> <a href="javascript:chgimg(-1)">previous</a> &nbsp;|&nbsp; <a href="javascript:auto()">auto/stop</a> &nbsp;|&nbsp; <a href="javascript:chgimg(1)">next</a></div>  <br><br>  <aside class="sidebar">         <div id="vmenu">             <ul>                 <li class="sideli"><a href="main.html.php">home</a></li>                 <li class="sideli"><a href="areas.html.php">areas</a></li>                 <li class="sideli"><a href="profiles.html.php">profiles</a></li>                 <li class="sideli"><a href="contactus.html.php">contact us</a></li>             </ul>           </div>      </aside>     <section class="main">         review submission , contact you, within 72 hours.</p>         <form action="actionemail.php" method="post">             <table class="emailtable">             <tr><td><label for="name" class="emaillabel">name: </label></td><td><input type="text" name="fullname" size="50" value="name" style="width: 290px;" /></td></tr>             <tr><td><label for="phone" class="emaillabel">phone: </label></td><td><input type="text" name="phone" size="20" value="phone" style="width: 290px;" /></td></tr>             <tr><td><label for="email" class="emaillabel">email: </label></td><td><input type="text" name="email" size="50" value="email" style="width: 290px;" /></td></tr>             <tr><td><label for="comment" class="emaillabel">issue: </label></td><td><textarea rows="3" cols="26" name="comment" value="tell more" style="width: 290px; height: 55px"></textarea></td></tr>             </table><br>             <input id="acknowledgment" type="checkbox" name="acknowledgment" value="1" onclick="enablesubmitbutton()"><label for="acknowledgment">i acknowledge there may delay in responding request.</label><br>         <br><input id="submitmessage" type="submit" name ="submitmessage" value="send email" disabled />         </form>     </section> </div> </body> </html> 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -