Home >Web Front-end >Front-end Q&A >How to modify table value in javascript
How to modify the table value in javascript: first open the corresponding front-end code file; then find the js code part; finally modify the value of td in the table through the "function getTdDirectly(){...}" method.
The operating environment of this article: windows7 system, javascript version 1.8.5, Dell G3 computer.
How to modify table value in javascript?
js changes the value of td in the table
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <table id='mytable'> <tbody> <tr> <td id='mytd'>这里是td的值</td> </tr> </tbody> </table> <br /> <input type='button' value='绝对路径获取td的值' οnclick='getTdDirectly()' /> <script> function getTdDirectly(){ var tdobj = document.getElementById('mytd'); tdobj.innerText = "ssss"; } </script>
Recommended study: "javascript Advanced Tutorial"
The above is the detailed content of How to modify table value in javascript. For more information, please follow other related articles on the PHP Chinese website!