Question

use Javascript The function ReBuildTheTable shifts the columns of the cars table one column to the...

use Javascript

The function ReBuildTheTable shifts the columns of the cars table one column to the right, so that makes the first column becomes the second, the second become the third, …, and the last one becomes the first.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Here is code:

 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta http-equiv="X-UA-Compatible" content="ie=edge" /> <title>Document</title> <script> function shift() { var data = []; var table = document.getElementsByTagName("table")[0]; for (var i = 0; i < table.rows.length; i++) { var tableRow = table.rows[i]; var rowData = []; for (var j = 0; j < tableRow.cells.length; j++) { rowData.push(tableRow.cells[j].innerText); } // for (var i = 0; i < 1; i++) { rowData.unshift(rowData.pop()); // } data.push(rowData); } for (var i = 0; i < table.rows.length; i++) { var tableRow = table.rows[i]; for (var j = 0; j < tableRow.cells.length; j++) { tableRow.cells[j].innerText = data[i][j]; } } console.log(data); } </script> </head> <body> <button onclick="shift()">shift</button> <br /> <br /> <table border="1"> <thead> <tr> <th> id </th> <th> first_name </th> <th> last_name </th> <th> email </th> <th> gender </th> <th> ip_address </th> </tr> </thead> <tbody> <tr> <td>1</td> <td>Corbet</td> <td>Petrushanko</td> <td>[email protected]</td> <td>Male</td> <td>19.219.224.72</td> </tr> <tr> <td>2</td> <td>Madelena</td> <td>Bysouth</td> <td>[email protected]</td> <td>Female</td> <td>151.69.82.101</td> </tr> <tr> <td>3</td> <td>Obed</td> <td>Causnett</td> <td>[email protected]</td> <td>Male</td> <td>179.236.61.107</td> </tr> <tr> <td>4</td> <td>Timmie</td> <td>Sheircliffe</td> <td>[email protected]</td> <td>Female</td> <td>216.237.107.82</td> </tr> <tr> <td>5</td> <td>Garrot</td> <td>Truluck</td> <td>[email protected]</td> <td>Male</td> <td>169.185.213.105</td> </tr> <tr> <td>6</td> <td>Reed</td> <td>Lanfranchi</td> <td>[email protected]</td> <td>Male</td> <td>168.12.249.106</td> </tr> <tr> <td>7</td> <td>Nico</td> <td>Gyngell</td> <td>[email protected]</td> <td>Male</td> <td>190.201.27.168</td> </tr> <tr> <td>8</td> <td>Heinrick</td> <td>Ketteringham</td> <td>[email protected]</td> <td>Male</td> <td>149.194.242.93</td> </tr> <tr> <td>9</td> <td>Mart</td> <td>Loosely</td> <td>[email protected]</td> <td>Male</td> <td>88.41.149.109</td> </tr> <tr> <td>10</td> <td>Avrit</td> <td>Grasner</td> <td>[email protected]</td> <td>Female</td> <td>247.46.27.164</td> </tr> <tr> <td>11</td> <td>Amabel</td> <td>Fink</td> <td>[email protected]</td> <td>Female</td> <td>124.238.247.247</td> </tr> <tr> <td>12</td> <td>Heindrick</td> <td>Bean</td> <td>[email protected]</td> <td>Male</td> <td>164.238.5.99</td> </tr> <tr> <td>13</td> <td>Collen</td> <td>Kimbell</td> <td>[email protected]</td> <td>Female</td> <td>200.83.21.222</td> </tr> <tr> <td>14</td> <td>Remy</td> <td>McCree</td> <td>[email protected]</td> <td>Female</td> <td>230.133.89.57</td> </tr> <tr> <td>15</td> <td>Cristal</td> <td>Cream</td> <td>[email protected]</td> <td>Female</td> <td>78.158.6.219</td> </tr> <tr> <td>16</td> <td>Danny</td> <td>Anning</td> <td>[email protected]</td> <td>Female</td> <td>73.130.129.74</td> </tr> <tr> <td>17</td> <td>Leah</td> <td>Ebrall</td> <td>[email protected]</td> <td>Female</td> <td>26.250.119.130</td> </tr> <tr> <td>18</td> <td>Flory</td> <td>Mellodey</td> <td>[email protected]</td> <td>Female</td> <td>36.30.119.163</td> </tr> <tr> <td>19</td> <td>Veriee</td> <td>Langeley</td> <td>[email protected]</td> <td>Female</td> <td>120.70.96.107</td> </tr> <tr> <td>20</td> <td>Gabrila</td> <td>Slatcher</td> <td>[email protected]</td> <td>Female</td> <td>177.25.218.140</td> </tr> </tbody> </table> </body> </html> 

Output:

Add a comment
Know the answer?
Add Answer to:
use Javascript The function ReBuildTheTable shifts the columns of the cars table one column to the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Question 1. Show the correct jQuery code for each of the following UI tasks: a) Select...

    Question 1. Show the correct jQuery code for each of the following UI tasks: a) Select all elements with class="name" and give each of them a unique id in the form "name-0", "name-1", "name-2"… and so on b) Anytime an element with class="trackClick" is clicked (using the "click" event), output the text "element clicked" to the console (using console.log()). This must work for all present and future elements with the class "trackClick". Question 2. Assume that there is only one...

  • Write out a table with signed binary numbers from 00002 to 11112 in one column and...

    Write out a table with signed binary numbers from 00002 to 11112 in one column and write the 2's complement of the numbers in the second column. In the third column write the signed decimal value of the numbers from the second column. Assume the MSB(Most Significant Bit) of the numbers in the first two columns is the sign bit (0= positive, 1= negative). Please Solve with Full steps Thank You.

  • Four liquids are described in the table below. Use the second column of the table to...

    Four liquids are described in the table below. Use the second column of the table to explain the order of their freezing points, and the third column to explain the order of their boiling points. For example, select 'l' in the second column next to the liquid with the lowest freezing point. Select '2' in the second column next to the liquid with the next higher freezing point, and so on. In the third column, select '1' next to the...

  • Four liquids are described in the table below. Use the second column of the table to...

    Four liquids are described in the table below. Use the second column of the table to explain the order of their freezing points, and the third column to explain the order of their boiling points. For example, select '1' in the second column next to the liquid with the lowest freezing point. Select '2' in the second column next to the liquid with the next higher freezing point, and so on. In the third column, select 'l' next to the...

  • Four liquids are described in the table below. Use the second column of the table to...

    Four liquids are described in the table below. Use the second column of the table to explain the order of their freezing points, and the third column to explain the order of their boiling points. For example, select '1' in the second column next to the liquid with the lowest freezing point. Select '2' in the second column next to the liquid with the next higher freezing point, and so on. In the third column, select 'l' next to the...

  • Four liquids are described in the table below. Use the second column of the table to...

    Four liquids are described in the table below. Use the second column of the table to explain the order of their freezing points, and the third column to explain the order of their boiling points. For example, select·1' in the second column next to the liquid with the lowest freezing point. Select '2, in the second column next to the liquid with the next higher freezing point, and so on. In the third column, select 'I' next to the liquid...

  • Four liquids are described in the table below. Use the second column of the table to explain the order of their freezing points, and the third column to explain the order of their boiling points. For...

    Four liquids are described in the table below. Use the second column of the table to explain the order of their freezing points, and the third column to explain the order of their boiling points. For example, select '1' in the second column next to the liquid with the lowest freezing point. Select '2' in the second column next to the liquid with the next higher freezing point, and so on. In the third column, select '1' next to the...

  • Four liquids are described in the table below. Use the second column of the table to...

    Four liquids are described in the table below. Use the second column of the table to explain the order of their freezing points, and the third column to explain the order of their boiling points. For example, select '1' in the second column next to the liquid with the lowest freezing point. Select '2' in the second column next to the liquid with the next higher freezing point, and so on. In the third column, select 'l' next to the...

  • Vonstreezing point dep Four liquias are described in the table below. Use the second column of...

    Vonstreezing point dep Four liquias are described in the table below. Use the second column of the table to explain the order of their freezing points, and the third column to explain the order of their boiling points. For example, select '1' in the second column next to the liquid with the lowest freezing point. Select '2' in the second column next to the liquid with the next higher freezing point, and so on. In the third column, select 'l'...

  • A six-column table for JKL Company follows. The first two columns contain the unadjusted trial balance...

    A six-column table for JKL Company follows. The first two columns contain the unadjusted trial balance for the company as of July 31, 2015. The last two columns contain the adjusted trial balance as of the same date. Analyze the differences between the unadjusted and adjusted trial balances to determine the adjustments that likely were made. Show the results of your analysis by entering these adjustment amounts in the cells provided.

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT