Advertisement
Guest User

Untitled

a guest
Aug 6th, 2015
1,041
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html>
  3.  
  4. <head>
  5. <style>
  6.  
  7. table{
  8. border-collapse: collapse;
  9.  
  10. }
  11.  
  12. table,tr, th, td{
  13. border: 3px solid black;
  14. }
  15.  
  16. td{
  17. text-align:center;
  18. height:100px;
  19. }
  20.  
  21. </style>
  22. </head>
  23. <body>
  24.  
  25. <input type="text" id="myText1" value="">
  26. <input type="text" id="myText2" value="">
  27.  
  28.  
  29. <button onclick="myFunction()">Try it</button>
  30.  
  31. <table style="width:100%" height."800px">
  32.  
  33. <tr><td id="td1">1</td><td>1</td></tr>
  34. <tr><td>1</td id="td2"><td>1</td></tr>
  35. <tr><td>1</td><td>1</td></tr>
  36.  
  37. </table>
  38.  
  39. var a=0;
  40. <script>
  41. function myFunction() {
  42.  
  43.  
  44. for (a=0;a<2;a++){
  45.  
  46.  
  47.     if (a==0){ document.getElementById("td1").value= document.getElementById("myText").value;}
  48. else if(a==1){document.getElementById("td2").value= document.getElementById("myText").value;}
  49.  
  50.  
  51.  
  52.  
  53. }
  54. </script>
  55.  
  56. </body>
  57. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement