If by "in the markup " you mean using the browser's "view source" function, then you're looking at the page source, it isn't updated to reflect DOM changes (it's the source, not the current document).
Use a web inspector or debugger to see what the current DOM looks like as markup, or get the form's innerHTML property.
Also, you should declare all those variables with var to keep them local.