How to use a variable as a value for attribute and setAttribute properties?

napTaurf

New Member
I'm trying to use setAttribute to change the link in an iframe.I want to get the link to change every few minutes to a new website chosen from an array.Everything seems to work except for one thing; I can't figure out how to get setAttribute to accept a variable or array as a link. For an example, my code looks something like this:\[code\]var linkList = [ 'link1', 'link2', 'link3'];function changePage() {for (i=0; i<4; i++) {document.getElementById('iframe').src = http://stackoverflow.com/questions/10468582/linkList;}}var timeoutNow = setTimeout("changePage()", 3000)\[/code\]The linkList part is the part I'm having trouble with - how do I get the src attribute to be set to a link stored in a variable or array?Thank you for any help you can provide.
 
Back
Top