so, i'm trying to do a table in HTML and my code is like this.
<script>
function addtable()
{
var incr;
incr += "<table id="nicetable"....
more code
incr += "</table>";
document.getElementById("divfortable").innerHTML=incr;
}
</script>
<div id="divfortable"></div>
And it appeared undefined and the table on my webpage. I've tried even commenting all of my code and only inserting a word in my "incr" variable, and still appeared the undefined word. So i did only:
document.getElementById("divfortable").innerHTML="hi";
And all went fine. And i've realized that the problem was from the var incr. And i don't know how to solve this. And it's quite odd, cuz I always do this to do tables, but now it's appearing the undefined word on the webpage.