我有一个xml的主题,我们的项目是创建一个xml网页,每个数据必须在xml中并将其写在xml上如何链接其他页面? 这是我的HTML
<!DOCTYPE html>
<title>Home</title>
<head>
<link rel = "stylesheet" href = "index.css">
</head>
<body>
<div class = "container">
<div class = "nav">
<div class = "navigation">
<script>
var xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET","nav.xml",false);
xmlhttp.send();
xmldoc=xmlhttp.responseXML;
var x = xmldoc.getElementsByTagName("title");
var y = xmldoc.getElementsByTagName("a");
document.write("<ul>")
for(i = 0;i<x.length;i++){
document.write("<li><a href = "+ i">")
document.write(xmldoc.getElementsByTagName("title") [i].childNodes[0].nodeValue);
document.write("</li></a>");
}
alert(y.length);
document.write("</ul>");
</script>
</div>
</div>
<div class = "content">
<div class = "logo">
</div>
</div>
<div class = "footer">
</div>
</div>
</html>
我也无法显示元素的内联列表 CSS
html, body{
margin:0px;
overflow:hidden;
}
.container{
position:absolute;
width:100%;
height:100%;
background-image:url("bg.jpg");
background-size: 100%;
}
.navigation{
position:absolute;
width:200px;
height:20px;
}
.nav{
position:relative;
height:12%;
width:100%;
background:rgba(0,0,0,0.6);
}
.nav>ul{
list-style-type: none;
}
.nav>ul>li{
display:inline;
padding:10px;
}
.content{
position:relative;
height:78%;
width:100%;
}
.footer{
position:relative;
height:10%;
width:100%;
}
.logo{
position:absolute;
height:100px;
width:100px;
background-image:url("logo.png");
background-size:100%;
}
xml文件
<?xml version = "1.0"?>
<root>
<nav xmlns:xlink="http://www.w3.org/1999/xlink">
<title xlink:type="simple" xlink:href="index.html">Home</title>
<title xlink:type="simple" xlink:href="collection.html">Collection</title>
<title xlink:type="simple" xlink:href="gamelibrary.html">Game Library</title>
<title xlink:type="simple" xlink:href="platform.html">Platforms</title>
</nav>
<href>
<a>collection.html</a>
<a>gamelibrary.html</a>
</href>
</root>