javascript - 如何放置 XML 值并在 href anchor 标记中使用它?

标签 javascript html xml

如何在 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/

相关文章:

javascript - 使用 JQuery 从 html5 视频播放器触发事件

javascript - jQuery Ajax - 下载不完整(二进制)文件

HTML:盒子模型和对齐

java - 简单XML : any element matching

android - 将边距设置为抽屉导航的默认分隔线

java - AndroidManifest.xml - 指定的属性 'manifest' 不存在

javascript - 媒体查询不工作最大宽度 : 900px

javascript - 当 JavaScript 返回 null & undefined 时?

html - 更改列中的输入大小

html - CSS3 变换 : scaling results in translation?