我正在尝试建立一个网站,当我点击 1 年级、2 年级等按钮时,它会在我的 div“结果”中加载一个页面。每次我单击同一页面上的按钮或 div 容器“结果”内的按钮时,都会加载不同的网站内容。我的代码如下。我试图使用 jQuery,但我对此并不陌生。
<html>
<head>
<script>
$(document).ready(function() {
$("#target").click(function(e) {
$('#result').load('http://www.youtube.com/user/EduGrade1');
e.preventDefault();
});
});</script>
</head>
<body>
<div id="div1">
<ul>
<li><a href="Grade.html"> CBSE Grades (1 to 12)</a>
<ul id="menu">
<li><a href "http://www.youtube.com/user/EduGrade1" id="target"> Grade 1 </a>
</li>
<li><a href "http://www.youtube.com/user/EduGrade2"> Grade 2 </a>
</li>
<li><a href "#"> Grade 3 </a>
</li>
<li><a href "#"> Grade 4 </a>
</li>
<li><a href "#"> Grade 5 </a>
</li>
<li><a href "#"> Grade 6 </a>
</li>
<li><a href "#"> Grade 7 </a>
</li>
<li><a href "#"> Grade 8 </a>
</li>
<li><a href "#"> Grade 9 </a>
</li>
<li><a href "#"> Grade 10 </a>
</li>
<li><a href "#"> Grade 11 </a>
</li>
<li><a href "http://www.youtube.com/user/EduGrade12"> Grade 12 </a>
</li>
</ul>
</li>
</ul>
<div>
<div id="div2">
<ul>
<li><a href="Home.html">Home</a>
</li>
</ul>
</div>
<p> </p>
<div id="result">
<script src="http://www.gmodules.com/ig/ifr?url=http://www.google.com/ig/modules/youtube.xml&up_channel=EduGrade12&synd=open&w=480&h=340&title=&border=%23ffffff%7C3px%2C1px+solid+%23999999&output=js"></script>
</div>
</body>