js-clickNumCount.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
    <input type="button" id="submit" value="clickMe">
    <select name="" id="select">
        <option value="">option1</option>
        <option value="">option2</option>
        <option value="">option3</option>
    </select>
</body>
<script>
    var count1 = 0,
        count2 = 0;
    document.getElementById('submit').addEventListener('click',function(){
        count1++;
        console.log("您已经点击button" + count1 + "");
        if(count1>1){
            alert("button超出点击次数!")
        }
    })
    document.getElementById('select').addEventListener('click',function(){
        count2++;
        console.log("您已经点击select" + count2 + "");
        if(count2>8){
            alert("select超出点击次数8!")
        }
    })
</script>
</html>
原文地址:https://www.cnblogs.com/cynthia-wuqian/p/4989149.html