Couple of small problems...
Your web browser interprets the code in order, so you're trying to assign a value to the <p> tag before it exists.
Also, you were missing a ' and
Code:
document.getElementById('info').innerHTML = "</tr></td></table>";
is simply writing over the contents of the <p> tag. Should be
Code:
document.getElementById('info').innerHTML += "</tr></td></table>";
This works (all changes are highlighted
Code:
<HTML>
<HEAD>
<TITLE>Test Input</TITLE>
<script type="text/javascript">
function runOnLoad() {
var myurl = new Array("google.com", "yahoo.com");
document.getElementById('info').innerHTML = "<table border='1'><tr><td>";
for (i=0;i<=myurl.length-1;i++){
document.getElementById('info').innerHTML += "<tr><td><a href='http://www."+myurl[i]+"' target='_blank'>"+myurl[i]+"</a></tr></td> ";
}
document.getElementById('info').innerHTML += "</tr></td></table>";
}
</script>
</HEAD>
<BODY onload="runOnLoad()">
<p id="info"></p>
</BODY>
</HTML>
One quick note -
Some of your html tags are capitals, some aren't. Use either one or the other, not both (I suggest lowercase).
Hope this helps!
Keyboard1333
Bookmarks