17.4.1 createcaption方法.html

来自「即学即用JavaScript核心对象参考手册原版光盘」· HTML 代码 · 共 24 行

HTML
24
字号
<body>
<form  name="frm">
  <input type="text" name="txt" />
  <input type="button" value="添加" onclick="addCaption()"/>
</form>
<table id="otable" border="1">
   <tr>
       <td>hello,how are you</td><td>you are welcome</td>
   </tr>
   <tr>
       <td>to</td><td>Javascript</td>
   </tr>
</table>
<script>
  function addCaption()
  {
     var otable=document.all.otable;
	 var txt=document.frm.txt.value;
	 var ocap=otable.createCaption();
	 ocap.innerHTML=txt.bold();
   }
</script>
</body>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?