<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script type="text/javascript">
        function test() {
            var obj = document.getElementById("nation").parentNode;//获取父容器
            var e = createEle();
            obj.appendChild(e);
        }
        function createEle() {
            var e = document.createElement("span");

            e.innerHTML = "test";
            return e
        }

    </script>
</head>
<body>
    <form action="#" method="post" id="myform">
    <table>
        <tr xmlns="">
            <td>
                <label>
                    民族</label>
            </td>
            <td>
                <input id="nation" name="nation" class="InputValue" type="text" />
            </td>
        </tr>
        <tr xmlns="">
            <td>
                <label>
                    爱好</label>
            </td>
            <td>
                <div id="hobby" style="needcheck: true; isnull: false; des: 爱好">
                    <input name="hobby" value="车" type="checkbox" checked="" />车<input name="hobby" value="特卖"
                        type="checkbox" />特卖</div>
            </td>
        </tr>
    </table>
    <input type="button" value="button" οnclick="test();" />
    </form>
</body>
</html>

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐