search

Home  >  Q&A  >  body text

The user logs in, queries the ranking list, how to obtain the ranking value through js, and reminds people within 30 people who are eligible to register through alert.

<div class="row">
    <div class="col-lg-12">
        <div class="form-group mb-3">
            <div class="form-control text-center" >您的积分总和为:{$score['perfor_sum']} 当前排名第<span id="ranking">{$ranking['perfor']}</span>位</div>
        </div>
    </div> <!-- end col -->
</div>

微信图片_20190719111634.png

<script>
    var oDiv = document.getElementById('ranking');
    alert(oDiv.innerHTML);
</script>

微信图片_20190719111723.png

Mr.LvMr.Lv1960 days ago1249

reply all(7)I'll reply

  • kanglecheng

    kanglecheng2019-07-19 14:32:35

    Just add judgment. For error reporting, please refer to https://www.php.cn/blog/detail/14059.html


    reply
    0
  • Mr.Lv

    still empty

    Mr.Lv · 2019-07-19 14:47:05
    kanglecheng

    1. Take a look at the examples in the link 2. Your data was not obtained

    kanglecheng · 2019-07-19 14:50:40
    Mr.Lv

    I’ve tried all of your 1, 2, and 3 writing methods, but the data is not obtained.

    Mr.Lv · 2019-07-19 15:11:34
    kanglecheng

    Data output from the background {$ranking['perfor']}

    kanglecheng · 2019-07-19 16:33:34
    kanglecheng

    Your tag must exist first. If you add judgment later and then render it, an innerHTML error will be reported.

    kanglecheng · 2019-07-19 16:37:49
  • kanglecheng

    kanglecheng2019-07-19 14:30:32

    Can’t reply? ?

    reply
    0
  • Cancelreply