相关疑难解决方法(0)

如何使用JavaScript在带有id的td中插入文本

我知道这可能是一件简单的事情,但我无法弄明白.我试图将一些来自JavaScript函数onload事件的文本插入到td中.

<html>
 <head>
  <script type="text/javascript">
   function insertText ()
   {
       //function to insert any text on the td with id "td1"
   }
  </script>
 </head>
 <body onload="javascript:insertText()">
  <table>
   <tr>
    <td id="td1">
    </td>
   </tr>
  </table>
 </body>
</html>
Run Code Online (Sandbox Code Playgroud)

有帮助吗?

html javascript

66
推荐指数
3
解决办法
28万
查看次数

标签 统计

html ×1

javascript ×1