Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 数字不为';单击向下箭头后t减小_Javascript_Jquery - Fatal编程技术网

Javascript 数字不为';单击向下箭头后t减小

Javascript 数字不为';单击向下箭头后t减小,javascript,jquery,Javascript,Jquery,我在这方面有问题。单击向上箭头后,数字会增加,但反之亦然。我认为jquery代码不够正确。我以为我只是从顶部变为底部,从+1变为-1,但我错了,它不起作用 守则: <?php include("mwcon.php"); ?> <html> <head> <link rel='stylesheet' type='text/css' href='/css/post.css'> <script src="https://aj

我在这方面有问题。单击向上箭头后,数字会增加,但反之亦然。我认为jquery代码不够正确。我以为我只是从顶部变为底部,从+1变为-1,但我错了,它不起作用

守则:

<?php
    include("mwcon.php");
?>
<html>
<head>
    <link rel='stylesheet' type='text/css' href='/css/post.css'>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
    <script>
        $(document).ready(function() {
          $(".post-vote-top").click(function() {
            $(this).next(".post-vote-middle").text(function(i, v) {
              return parseInt(v, 10)+1;
            });
          });
        });
        $(document).ready(function() {
          $(".post-vote-bottom").click(function() {
            $(this).next(".post-vote-middle").text(function(i, v) {
              return parseInt(v, 10)-1;
            });
          });
        });
    </script>
</head>
<body>
<?php
    echo "
        <div id='post'>
            <table>
    ";
    $no=1;
    $q=mysql_query("SELECT * FROM t_post");
    while($f=mysql_fetch_object($q)){
        echo "
            <tr>
                <td class='post-nomor'>$no.</td>
                <td class='post-vote' align='center'>
                    <div id='main'>
                        <div class='post-vote-top'></div>
                        <div class='post-vote-middle'>$f->vote</div>
                        <div class='post-vote-bottom'></div>
                    </div>
                </td>
                <td><a href='$url' target='_blank'><img src='$f->linkimg' width='80' height='50'></img></a></td>
            </tr>
        ";
        $no++;
    }
    echo "
            </table>
        </div>
    ";
?>
</body>
</html>

$(文档).ready(函数(){
$(“.post vote top”)。单击(函数(){
$(this).next(“.post-vote-middle”).text(函数(i,v){
返回parseInt(v,10)+1;
});
});
});
$(文档).ready(函数(){
$(“.post-vote-bottom”)。单击(函数(){
$(this).next(“.post-vote-middle”).text(函数(i,v){
返回parseInt(v,10)-1;
});
});
});
您需要使用而不是,因为
.post vote middle
之前。post vote bottom

$(文档).ready(函数(){
$(“.post vote top”)。单击(函数(){
$(this).next(“.post-vote-middle”).text(函数(i,v){
返回parseInt(v,10)+1;
});
});
$(“.post-vote-bottom”)。单击(函数(){
$(此).prev(“.post-vote-middle”).text(函数(i,v){
返回parseInt(v,10)-1;
});
});
});

$no。
向上的
1.
向下
$no。
向上的
1.
向下

OMG.我为你感到羞耻@balan。很抱歉,我是jquery的新手。我根本没有老师。它现在运行良好。也许在接下来的几个小时里,我会再问你一次,巴兰。@Junaserbaserbi:很高兴能帮助:)普拉纳夫,请再帮我一次