我制作了一个代码,单击不同的链接时,特定的部门会分别发生变化。
第一个文件是: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 文件,其中必须出现在分区 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。它不工作。里面有问题。我不知道错误在哪里。它也确实发生了变化,因为我早些时候已经厌倦了它并且它起作用了,现在我忘记了它第一次是如何做的。