našel jsem tohle:
function getCode(object, print, stripTags, nl2){
object=(!object)?self: (typeof(object)=="string")?document.getElementById(object):
object;
//
if(!object.childNodes){/*object was a window or frame - this bypasses id of empty tags*/
object=object.document.getElementsByTagName('HTML');
if(!object){object=object.document.getElementsByTagName('BODY');};
if(!object){return "";};/*no such nodeName tag*/
object=object[0].innerHTML;
}
else{/*object was a DOM node*/object=object.innerHTML;};
//
if(stripTags){
object=object.replace(/<\/?(br|p|div|[ou]l|li|hr).*?>/gi,"\n");
object=object.replace(/<[^>]+>/g,'');//not earlier
object=object.replace(/ /gi, ' ');
};
if(nl2){object=object.replace(/(\s*\r?\n\s*){3,}/g,"\n\n");};//not earlier
if(object && print){
var area="<html><head><title>SOURCE CODE</title></head><body><div align='center'><form><input type='button' value='Close Window' onClick='self.close()'><textarea cols='70' rows='20' onFocus='this.select()' onBlur='this.value=resetForm' wrap='hard' name='htmlTextarea'><textarea></form></div></body></html>";
var win=window.open("","win","scrollbars,resizable,width=620,height=370");
win.document.write(area); win.document.close(); win["resetForm"]=win.document.forms[0].htmlTextarea.value=object; win.focus();
}
return object;
}
netestoval sem to, javascript sice trochu umim, ale nezkoumal sem to,možná to nedělá co chceš...
nebo můžeš použít AJAX. To mě přijde jako elegantnější řešení.