给按钮添加事件的方法

<form action="" method="post" id="forma">
            <input type="button" value="移出" id="it" />

        </form>


<script>
var it = document.getElementById('it');

        // abc.onlick = function() {
        //     alert(1);
        // }

        //console.log(typeof(it));

        it.onclick = function() {
            alert(1);
        }

        it.addEventListener('click', function() {
            alert(1);
        })

</script>

因为 type="submit" 本身就提交一个事件,所以 改为 type="button"

发表评论