0

異なるリンクをクリックすると、特定の部門がそれぞれ変更されるコードを作成しました。

最初のファイルは: index.html

<div class="wrapper">       
    <div class="grid3 first">
        <ul class="categories">
            <li><a id="Engineering">Aerospace</a></li>
            <li><a id="Productive">Automotive</a></li>
            <li><a href="Chemicals">Chemicals</a></li>
        </ul>
    </div>
    <section id="neeraj_content">    
        <div class="grid19" id="Engineering" >
            <h2>Grow service revenue with world-class<br/>
            lifecycle service and support.</h2>
            <p>some displaying content here that appears in the division grid19 </p>
        </div>
    </section>
</div>

このインデックスファイルにはjsがあります

<script>
    $(document).ready(function(){
        $('#neeraj_menu ul li a').click(function(){
            $('#neeraj_content').load('division.html #' + $(this).attr('href'));
            return false;
        });
    });
</script>

ここで、division.html という名前の別の html ファイルを作成しました。このファイルでは、division grid19 に表示する必要がある他のコンテンツをその特定の位置に表示する必要があります。

        <div class="grid19" id="Engineering" >
            <h2>Grow service revenue with world-class<br/>
            lifecycle service and support.</h2>
            <p>some displaying content here that appears in the division grid19 </p>
        </div>
    </section>
</div>

        <div class="grid19" id="Productive" >
            <h2>Grow service revenue with world-class<br/>
            lifecycle service and support.</h2>
            <p>some displaying content here that appears in the division grid19 </p>
        </div>
    </section>
</div>

        <div class="grid19" id="Chemicals" >
            <h2>Grow service revenue with world-class<br/>
            lifecycle service and support.</h2>
            <p>some displaying content here that appears in the division grid19 </p>
        </div>
    </section>
</div>

生産的または化学物質をクリックすると、部門の内容を変更する必要があります。変更するのに問題があります。実際には、division.html ファイル内の特定の ID にアクセスします。動いていない。問題があります。エラーの場所がわかりません。また、以前に疲れていてうまくいったので、最初はどうだったか忘れてしまいました。

4

1 に答える 1

0

あなたが参照している:

$('#neeraj_menu ul li a').click(function(){

しかし、あなたが提供するhtmlコードでは、id neerajは表示されません

于 2013-06-18T11:07:15.550 に答える