Jump to content

Debuging my debug routine


george
 Share

Recommended Posts

To help me debug a form, I created this simple little script

function showme() {	x = document.getElementById("edPropForm");	for (var i=1; i<x.length; i++) {		document.write(x.elements[i].id);	}}

Which after the first field id is given, stops in it's tracks with a permission denied message. The error message is the standard IE Windows alert type message box. Any ideas?

Link to comment
Share on other sites

Idea 1. You start with i=1 instead of i=0.Idea 2. If a form element has no value, or an undefined value, your loop will probably break, yeah.EDIT:Idea 3. You're using document.write() but the document is already written and closed, so the method overwrites the original document in the first loop iteration. Try alert() instead of document.write()

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...