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>

 

posted @ 2015-11-23 17:46  Cynthia娆墨旧染  阅读(464)  评论(0编辑  收藏  举报