Code:
<html>
<head>
<title>XML Database League</title>
{$headerinclude}
<style type="text/css">
table, th, td {
border: 1px solid black;
border-collapse:collapse;
background-color: #E1EEF4;
}
th, td {
padding: 5px;
font-family: Verdana ;
font-size: 18px;
line-height: 15.4px;
}
p {color:green} ;
</style>
<script type="text/javascript">
if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
}
else {// code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET", "xmleague.xml", false);
xmlhttp.send();
xmlDoc = xmlhttp.responseXML;
var x = xmlDoc.getElementsByTagName("Team");
function displayXMLeague(i) {
var leagueElement = x[i];
Team_Name = (leagueElement.getElementsByTagName("Team_Name")[0].childNodes[0].nodeValue);
description = (leagueElement.getElementsByTagName("description")[0].childNodes[0].nodeValue);
City = (leagueElement.getElementsByTagName("City")[0].childNodes[0].nodeValue);
Stadium = (leagueElement.getElementsByTagName("Stadium")[0].childNodes[0].nodeValue);
var players = leagueElement.getElementsByTagName("first_name");
var player;
var playerString;
for(var index = 0; index < players.length; index++)
{
player = players[index];
if (index == 0)
{
playerString = player.childNodes[0].nodeValue;
}
else
{
playerString = (playerString + "<br />" + player.childNodes[0].nodeValue);
}
}
Players = playerString;
image = (leagueElement.getElementsByTagName("image")[0].childNodes[1].childNodes[0].nodeValue) ;
txt = "<br><b>Logo:</b>" + "<img src='"+image+"'/>" + "<br><b>Team_Name:</b> " + Team_Name + "<br><b>Description:</b> "+ description + "<br><b>City:</b> " + City + "<br><b>Stadium:</b> " + Stadium + "<br><mark><b>Legends Players:</b></mark><ul>" + Players ;
document.getElementById("showXMLeague").innerHTML = txt;
}
displayXMLeague(0);
</script>
</head>
<body>
{$header}
<h2>List of Premier League clubs </h2>
<p>Update with More <ins>Teams Clubs And Leagues</ins>... for the next version</p>
<div id='showXMLeague' style="font-family:verdana; font-size: 18px;">Click on a Team Club to display information.</div><br>
<script>
document.write("<table border='2'>");
for (var i=0;i<x.length;i++)
{
document.write("<tr onclick='displayXMLeague(" + i + ")'>");
document.write("<td>");
document.write(x[i].getElementsByTagName("Team_Name")[0].childNodes[0].nodeValue);
document.write("</td><td>");
document.write(x[i].getElementsByTagName("City")[0].childNodes[0].nodeValue);
document.write("</td></tr>");
}
document.write("</table>");
</script>
{$footer}
</body>
</html>
[Video: