日期:2014-05-16  浏览次数:20447 次

怎么在div里面点击后,数字就增加一次啊?新手啊,具体讲讲
            <div class="zan">
                <div id="btn" class="subBtn" onclick="">
                    <div style="color:#FFF;padding:63px 0 0 0;">
                        <span> 52 </span>
                    </div>
                </div>

                <div class="subBtn down" onmouseover="chg()" onclick="chg()" style="display:none">
                    <div style="color:#FFF;padding:63px 0 0 0;">
                        <span> 52 </span>
                    </div>
                </div>    <!----点击后备用------>

------解决方案--------------------
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript" src="Scripts/jquery-1.4.1.min.js"></script>
    <script>

        function test() {
            $("#btn div span").html(parseInt($("#btn div span").html()) + 1)
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
         <div id="btn" class="subBtn" onclick="javascript:test()">
                    <div>
                        <span> 52 </span>
                    </div>
                </div>


    </div>
    </form>
</body>
</html>

------解决方案--------------------
借用了zhanglong_longlong的模板

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript" src="Scripts/jq