CharmingGeek.net Funness

September 30, 2004

Javascript Form Debugger

Filed under: general — bdparker @ 12:41 am

Not that any of you care, but I wrote this so that I could tell exactly what is submitted with a form.
This javascript function will create a new window revealing all form values on a page. fun stuff.

function formdebugger(){
theWindow = null;
theWindow=window.open('','theWindow','resizable=yes,scrollbars=yes');
theNewDocument = theWindow.document; for(i=0;i<document.forms.length;i++){
theForm=document.forms[i];
theNewDocument.write('<table border="1"><tr><th>Form</th><th colspan=3>' + theForm.name + ' </th></tr>'
+'<tr><th rowspan="'+(theForm.elements.length+1)
+'">Elements</th><th>Name</th><th>Type</th><th>Value</th></tr>'); for(j=0;j<theForm.elements.length;j++){
theElement=theForm.elements[j];
theNewDocument.write("<tr><td>"+theElement.name + " </td><td>" + theElement.type
+ " </td><td>" + theElement.value + " </td></tr>"); }
theNewDocument.write('</tr></table><br/><br/>');
}
theNewDocument.close();
theWindow.focus();
}

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Powered by WordPress