2020年12月19日星期六

Why my data does not appear after I submit? I did not see any wrong there?

it should appear new row in my table that contain data i input in the form, but instead it does not appear anything when submit. I can not find any wrong there though. can you help me?

<!DOCTYPE html>  <html>  <head>  <script>  function myFunction(){    //declare my function to add table      var tbl = document.getElementById("myTable");      var r = tbl.insertRow();      var cell1 = r.insertcell();      var cell2 = r.insertcell();      var cell3 = r.insertcell();      var cell4 = r.insertcell();            cell1.innerHTML = document.getElementById("tid").value;      cell2.innerHTML = document.getElementById("tusername").value;      cell3.innerHTML = document.getElementById("toccupation").value;          }         </script>    </head>  <body>    <form onsubmit="myFunction(); return false;"> //form     <input type="Number" id="tid" placeholder="ID"/><br/>    <input type="text" id="tusername" placeholder="Name"/><br/>   <input type="text" id="toccupation" placeholder="Occupation"/><br/>     <input type="submit" value="Add data"/>   <input type="reset" value="clear"/>   </form>     <table id="myTable" border=1>      <tr>   <th>ID</th>   <th>Name</th>   <th>Occupation</th>   </tr>     </table><br>     </body>   </html>  


from Recent Questions - Stack Overflow https://stackoverflow.com/questions/65376933/why-my-data-does-not-appear-after-i-submit-i-did-not-see-any-wrong-there cooly blogy

没有评论:

发表评论