I have created an iFrame and I am looking to dynamically change its source to one of 10 different URLs each time it loads:
Here is the desired behavior:
iFrame loads => change to example.com => iFrame loads => change to example1.com => iFrame loads => change to example2.com...
Is there a way to achieve this functionality? I am currently stuck on how to proceed and would appreciate any guidance.
<html>
<body>
<iframe src="http://www.example.com"> </iframe>
<script>
var links = [
"http://www.js.com",
"http://example.com",
"http://example1.com"];
alert(links[2])
function srca (){
document.getElementsByTagName('iframe')[0].src = links[0]
}
</script>
</body>
</html>