How to modify table value in javascript

藏色散人
Release: 2021-07-03 09:40:48
Original
2528 people have browsed it

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.

How to modify table value in javascript

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=&#39;mytable&#39;>
<tbody>
<tr>
<td id=&#39;mytd&#39;>这里是td的值</td>
</tr>
</tbody>
</table>
<br />
<input type=&#39;button&#39; value=&#39;绝对路径获取td的值&#39; οnclick=&#39;getTdDirectly()&#39; />
<script>
function getTdDirectly(){
var tdobj = document.getElementById(&#39;mytd&#39;);
tdobj.innerText = "ssss";
 
}
 
 
</script>
Copy after login
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template