xml を次のように変更した場合:
<?xml version="1.0" encoding="ISO-8859-1"?>
<events>
<event>
<date>
<weekday>ven</weekday>
<day>15</day>
<month>feb</month>
</date>
<place>
<name>Blue Sound</name>
<city>Nola</city>
<address>Corso Italia 7</address>
</place>
<band>
<name>Random Jazz 6some</name>
<link>http://randomjazz6.ran</link>
<members>
<drummer> Random Drummer </drummer>
<vocal> Random Vocalist </vocal>
<bass>Random Bassist</bass>
<guitar>Random Guitar</guitar>
<keys>Random keyboarder</keys>
<other>Random otherist</other>
</members>
</band>
<description>this is the event number 1, ven 15 feb</description>
</event>
<event>
<date>
<weekday>ven</weekday>
<day>1</day>
<month>mar</month>
</date>
<place>
<name>Dada</name>
<city>Chicago</city>
<address>Random Street 7</address>
</place>
<band>
<name>Random Jazz band 2</name>
<link>http://randomjazzband2.ran</link>
<members>
<drummer> Random Drummer </drummer>
<vocal> Random Vocalist </vocal>
<bass>Random Bassist</bass>
<guitar>Random Guitar</guitar>
<keys>Random keyboarder</keys>
<other>Random otherist</other>
</members>
</band>
<description>this is the event number 2, ven 1 mar</description>
</event>
</events>
および次の JavaScript:
$(document).ready(function () {
var day = xmlDoc.getElementsByTagName("day")[0].childNodes[0].nodeValue;
var weekday = xmlDoc.getElementsByTagName("weekday")[0].childNodes[0].nodeValue;
var month = xmlDoc.getElementsByTagName("month")[0].childNodes[0].nodeValue;
var sideVoice = '<a class="date" onclick="showEv()">' + weekday + day + month + '</a>';
document.getElementById("side_dates").innerHTML = sideVoice;
});
function showEv() {
document.getElementById("event_content").innerHTML = xmlDoc.getElementsByTagName("description")[0].childNodes[0].nodeValue;
}
<event>
XML 内のそれぞれについて、子とこの子の値<a class="date" onclick="ShowEV()">
を含むリスペクティブを追加するにはどうすればよいですか?<date>
<date>
</a>