How to dynamically modify the colspan column of a table row in js
This article describes how to dynamically modify the colspan column of a table row in javascript. The example shows how to dynamically modify the table attribute in html by using javascript, for more information, see
This article describes how to dynamically modify the colspan column of a table row in js. Share it with you for your reference. The details are as follows:
?
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
<! DOCTYPE html> <Html> <Head> <Script> Function setColSpan () { Var x = document. getElementById ('mytable'). rows [0]. cells; X [0]. colSpan = "2 "; X [1]. colSpan = "6 "; } </Script> </Head> <Body> <Table id = "myTable" border = "1"> <Tr> <Td colspan = "4"> cell 1 </td> <Td colspan = "4"> cell 2 </td> </Tr> <Tr> <Td> cell 3 </td> <Td> cell 4 </td> <Td> cell 5 </td> <Td> cell 6 </td> <Td> cell 7 </td> <Td> cell 8 </td> <Td> cell 9 </td> <Td> cell 10 </td> </Tr> </Table> <Form> <Input type = "button" onclick = "setColSpan ()" Value = "Change colspan"> </Form> </Body> </Html> |
I hope this article will help you design javascript programs.