欢迎来到【一个大西瓜】的博客

不曾为梦想奋斗,拿什么去燃烧青春。有梦之人亦终将老去,但少年心气如昨。
太阳每一个时刻都同时是夕阳和朝阳,每天她沉入西边,意味着她同时从另一面土地升起。
扩大
缩小

button轮番点击,只点击一次,鼠标hover

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <script src="scripts/jquery-1.7.1.js"></script>
    <script>
        $(function () {
            ////合成指向、移开事件
            //$('#btnShow').hover(function () {//指向
            //    this.style.color = 'red';
            //}, function () {//移开
            //    this.style.color = 'black';
            //});


            //合成点击事件, 指定在n个函数间切换,点击次数为m
            //$('#btnShow').toggle(function () {//第m%n==1次点击时执行此函数
            //    alert(1);
            //}, function () {//第m%n==2次点击执行此函数
            //    alert(2);
            //}, function () {//第m%n==0次点击执行此函数
            //    alert(3);
            //});

            //合成事件:只将绑定的事件执行一次
            $('#btnShow').one('click', function () {
                alert(1);
            });
        })
    </script>
</head>
<body>
    <input id="btnShow" type="button" value="显示" />
</body>
</html>

posted on 2016-11-09 16:21  一个大西瓜咚咚咚  阅读(236)  评论(0编辑  收藏  举报

导航