Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <style>
- table{
- border-collapse: collapse;
- }
- table,tr, th, td{
- border: 3px solid black;
- }
- td{
- text-align:center;
- height:100px;
- }
- </style>
- </head>
- <body>
- <input type="text" id="myText1" value="">
- <input type="text" id="myText2" value="">
- <button onclick="myFunction()">Try it</button>
- <table style="width:100%" height."800px">
- <tr><td id="td1">1</td><td>1</td></tr>
- <tr><td>1</td id="td2"><td>1</td></tr>
- <tr><td>1</td><td>1</td></tr>
- </table>
- var a=0;
- <script>
- function myFunction() {
- for (a=0;a<2;a++){
- if (a==0){ document.getElementById("td1").value= document.getElementById("myText").value;}
- else if(a==1){document.getElementById("td2").value= document.getElementById("myText").value;}
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement