samedi 31 janvier 2015

Change href in html


I have next code, but it's don't work:



<html>
<head>
<title>Title</title>
</head>

<body>
<script type='text/javascript'>
window.onload = function(){
var links = document.getElementsByTagName('A');
for(var i = 0; i < links.length; i++){
links[i].href = 'test.html';
}
}
</script>
<ul>
<li><a href = 1.html>1.</a></li>
<li><a href = 2.html>2.</a></li>
<li><a href = 3.html>3.</a></li>
</ul>
</body>
</html>


I need to change ALL links, on 'test.html'. Without JQuery.





Aucun commentaire:

Enregistrer un commentaire