Reply
Fri 2 Jan, 2015 05:27 am
Hello, my question how do i make my code which creates one link with arrays into a loop which would create links from all of the arrays values?
<html>
<head>
</head>
<body>
<script>
var links = ["http://example.com","http://example.com","http://example.com","http://example.com"];
var titles = ["link1","link2","link3","link4"];
var a = document.createElement('a');
var linkText = document.createTextNode(titles[0]);
a.appendChild(linkText);
a.title = titles[0];
a.href = links[0];
document.body.appendChild(a);
</script>
</body>
</html>