Change links : links « Document « JavaScript Tutorial
- JavaScript Tutorial
- Document
- links
<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>