<ul id="list">
<li><a href="#">1</a></li>
<li><a href="#">2</a></li>
<li><a href="#">3</a></li>
<li><a href="#">4</a></li>
</ul>
<div id="inf1"></div>
<div id="inf2"></div>
<script>
window.onload = function () {
var list = document.getElementById('list');
var inf1 = document.getElementById('inf1');
var inf2 = document.getElementById('inf2');
var mas1 = ["inf1.0", "inf1.1", "inf1.2", "inf1.3"];
var mas2 = ["inf2.0", "inf2.1", "inf2.2", "inf2.3"];
list.onclick = function (e) {
e = e || event;
var target = e.target || e.srcElement;
if (target.tagName == 'A') {
var num = target.innerHTML - 1;
inf1.innerHTML = mas1[num];
inf2.innerHTML = mas2[num];
}
}
}
</script>
|