How to view the html generated by Javascript document.write commands
If you have some dynamically generated content in your web page such as a DHTML menu and you want to view the generated code then you can not see it using View Source but you can display it using the Javascript command :
alert(document.documentElement.innerHTML);
I tend to not use alert but open a new window and redirect the output to that window. This leads to many other interesting debugging possiblities.
Update:
Here is the Javascript function for outputting the results to a new window:
function newWin(){
win= window.open('','_blank');
var results =document.documentElement.innerHTML;
var match = "<";
var re = new RegExp("<", "g");
var newresults = results.replace(re, "<");
win.document.write(newresults );
}