【发布时间】:2014-03-23 01:07:46
【问题描述】:
我有一个 xml 文件,其中包含几个内部 html 页面的链接。我正在使用 HTML DOM 来获取这些链接并在表格中显示这些链接。这些链接是简单的 html 链接,没有参数。这些 html 页面驻留在服务器中。
我的问题是,当我在网站管理员工具中使用 fetch 作为 google 时。谷歌正在获取 javascript 但不是填充的表。谷歌会抓取这些链接并将其编入索引吗?我想确保将此处链接的这些页面编入索引...请指导我完成此问题。也让我知道是否有更好的方法来显示来自 xml 的内容,以便谷歌抓取这些链接。
<script>
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","/jobs/jobs.xml",false);
xmlhttp.send();
xmlDoc=xmlhttp.responseXML;
document.write('<table id="example">');
document.write('<thead><tr><th>Job ID</th><th>Job Title</th><th class=\"mobexcl\">Location</th><th class=\"mobexcl\">Country</th><th class=\"mobexcl\">Date Posted</th><th>Status</th><th class=\"mobexcl\">View</th></tr></thead><tbody>');
var x=xmlDoc.getElementsByTagName("CD");
for (i=0;i<x.length;i++)
{
if(i%2==0){
document.write('<tr class="alt">');
}
else{
document.write('<tr class="alt1">');
}
document.write("<td>");
document.write('<a href="' + x[i].getElementsByTagName("VIEW")[0].childNodes[0].nodeValue + '">'+x[i].getElementsByTagName("JOBID")[0].childNodes[0].nodeValue+'</a>');
document.write("</td><td>");
document.write(x[i].getElementsByTagName("TITLE")[0].childNodes[0].nodeValue);
document.write("</td><td class=\"mobexcl\">");
document.write(x[i].getElementsByTagName("LOCATION")[0].childNodes[0].nodeValue);
document.write("</td><td class=\"mobexcl\">");
document.write(x[i].getElementsByTagName("COUNTRY")[0].childNodes[0].nodeValue);
document.write("</td><td class=\"mobexcl\">");
document.write(x[i].getElementsByTagName("DATE")[0].childNodes[0].nodeValue);
document.write("</td><td>");
document.write(x[i].getElementsByTagName("STATUS")[0].childNodes[0].nodeValue);
document.write("</td><td class=\"mobexcl\">");
document.write('<a href="' + x[i].getElementsByTagName("VIEW")[0].childNodes[0].nodeValue + '">View/Apply</a>');
document.write("</td></tr>");
}
document.write("</tbody></table>");
</script>
【问题讨论】:
-
这个问题似乎是题外话,因为它是关于 SEO
标签: javascript html seo