0
我已完成所有設置和工作,但今天下午發生了一些變化,無法放置缺少的內容。使用jquery更改div中的內容
基本上,jquery腳本根據在側邊菜單中單擊的鏈接來更改#text_box的內容。點擊時腳本從information_database.html中檢索相關的href。
有誰知道缺什麼?
<script type="text/javascript" charset="utf-8">
$(document).ready(function(){
$('#accordion ul li a').click(function(){
('#text_box').load('information_database.html #' + $(this).attr('href'));
return false;
});
});
</script>
繼承人的鏈接的樣本:
<div id="container">
<div id="side_bar">
<div id="accordion">
<h1 class="blue white_text"><img src="ear_square.png">Ear</h1>
<div><ul class="blue">
<li><a href="glue_ear">Glue ear/Adenoidectomy</a></li>
<li><a href="meatoplasty">Meatoplasty</a></li>
<li><a href="canalplasty">Canalplasty</a></li>
<li><a href="cholesteatoma">Cholesteatoma</a></li>
<li><a href="ossiculoplasty">Ossiculoplasty</a></li>
<li><a href="myringoplasty">Myringoplasty</a></li>
<li><a href="otosclerosis">Otosclerosis</a></li>
</ul></div>
</div>
</div>
</div>
而且在information_database.html數據的樣本:
<div id="meatoplasty">
<h1 class="blue_text">Meatoplasty</h1>
<p>This is an operation to widen the opening of your ear canal. It may be performed as a procedure by itself, but more often it is performed as a part of ear surgery for other conditions. The opening of the ear canal (meatus) is formed mainly of cartilage and skin at its most outer part. If this is narrow, this may result in wax blockage, outer ear infections, difficulty wearing hearing aids and difficulty in examining or treating your ear in the outpatient clinic.
</div>
哪裏是在所有這一切的'#text_box'。 ?它只是一個分區? –
控制檯中的錯誤? – j08691
你在這裏錯過了一些'('#text_box')'。不應該是'$('#text_box')'? – DavidDomain