insertAdjacentHTML的用法

<script language="javascript">
    function insertHTML(){
        window.event.srcElement.insertAdjacentHTML('BeforeBegin','<input id="oInput">');
        document.all['delete'].disabled = false;
    }
    function deleteHTML(){
        document.all['oInput'].removeNode(true);
        window.event.srcElement.disabled = true;
    }
</script>
<input type="button" id="add" value="添加" onclick="insertHTML();">
<input type="button" id="delete" value="删除" onclick="deleteHTML();" disabled>

你可能感兴趣的:(insert)