如何在 HTML 网页上读取 XML 文件?
我只懂非常基础的 JavaScript。我正在尝试使用 XML 更改我网站页脚的值,因为我有 100 多页,每次我更改页脚中的内容时,我都必须手动更改所有 100 页。这就是我想通过 XML 更改页脚链接的原因。
我希望我的 XML 链接值进入 anchor 标记 href 属性:
<a href="here goes the url using xml">
此外, anchor 标签之间的网站名称也是:
<a href="here goes link value ">here goes the name of the url using xml</a>
我的 HTML 页面应该如下所示:
<a href "here goes the url">here goes the name of the url using xml</a>
最佳答案
如果您只想更改页脚并且在 100 页中使用了页脚, 你可以这样做。 制作页脚 html 页面并将其包含在每个页面中。 这样,如果您需要对页脚进行任何更改,则需要在一个地方进行。 在jsp中你必须写
<jsp:include page="PageFooter.jsp" />
这个解决方案也可能有帮助 How to include an HTML page into another HTML page without frame/iframe?
关于javascript - 如何放置 XML 值并在 href anchor 标记中使用它?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14079326/