js-位置问题

  <div class="pages">
        <svg width="100%" height="400">
            <polygon id="green" points="0,0 1000,0 1000,370 0,320" fill="#1AA79A"/>
            <polygon id="orange" points="0,0 1000,0 1000,320 0,370" fill="#F87335"/>
            <polygon id="yellow" points="0,0 1000,0 1000,320 0,320" fill="#F8CD0B"/>
            <polygon id="black" points="0,0 1000,0 1000,260 0,320" fill="#313639"/>
        </svg>
    </div>

    <h1>
        <div class="brackets">
            <i class="icon-quote-left"></i>
            <span>{{ kind }}教材</span>
            <i class=" icon-quote-right"></i>
        </div>
        <small>SECOND HAND BOOK</small>
    </h1>
</div>


<div class="container">
    <div class="row">
        <script type="text/javascript">
            if ("{{ classfy.remakes }}" == "购买") {
                var traget = document.getElementById('ca');
                if (traget.style.display == "none") {
                    traget.style.display = "";
                }
                else
                    traget.style.display = "none";
                alert("{{ classfy.remakes }}");
            }
        </script>
        {% for classfy in class_all %}
            <div class="col-md-4 col-sm-6 co

 其中 js 因为所需要寻找的 id 在其下 所以id找不到。

以至于js运行出错。

所以 吃一堑长一智喽

需要把js放在所需要寻找的id等等的下面

posted @ 2016-01-17 10:00  echoocking  阅读(163)  评论(0)    收藏  举报