Change links : links « Document « JavaScript Tutorial






<html>
<head>
<title>Link Modifier</title>

</head>
<body>

<h1>Link Modifier</h1>

<P>
<a href="http://www.java2s.com/">Example</a><br />
<a href="http://www.java2s.com/">Example</a><br />
<a href="http://www.java2s.com/">Example</a><br />
<a href="http://www.java2s.com/">Example</a><br />
<a href="http://www.java2s.com/">Example</a><br />
<a href="http://www.java2s.com/">Example</a><br />
</p>

<script language="javascript" type="text/javascript">
<!--

var indexPage = "/index.html";
var allLinks = document.links;
for (var i=0; i<allLinks.length; i++) {
  allLinks[i].href = allLinks[i].href + indexPage;
}

//-->
</script>

</body>
</html>








14.18.links
14.18.1.document.links
14.18.2.document.links.length
14.18.3.Get all links on a page
14.18.4.Change links