日期:2014-05-16 浏览次数:20361 次
<form name="form1"> <table> <tr> <td id="a1">文字</td> <td><input type="button" value="按钮"></td> </tr> </table> </form> <script language="javascript"> window.onload = function() { var td = document.getElementById("a1"); td.innerHTML = ["<input type='button' value='",td.innerHTML,"'>"].join(''); alert(document.getElementsByName("form1")[0].elements.length); } </script>