checking which DIV I am on ....DOM Stuff

admin

Administrator
Staff member
Is it possible to check the division (if any) that a form element
is from, so that I can make sure it is set to visible before I try
to set the focus and colour etc.? See the pseudocode below for a better explanation of what I am trying to do.

I figured I can do some validatation on each <DIV> on changing to another <DIV> but I am curious now to find out if there is a way of discerning if the element is in a <DIV>.


//////////////////THIS BLOCK ENSURES MANDATORY FIELDS ARE POPULATED/////////////////////////////////

for (var i=0, j=form.elements.length; i<j; i++) {
if ((form.elements.id =="1")&&isNotblank(form.elements.value)==false)
{
check1=false;
// pseudocode
// HEre I want a way to figure out if a the element
// belongs to a <DIV> and to set that <DIV> to
// visible before I try to focus or setColor on the element
// If I don't make sure the <DIV> is visible, then if it is not,
// the javascript throws an error.

var divisionName = form.div.name;
divisionName+ .style.display = "";


setColor(form.elements,bgBad);
form.elements.focus();
form.elements.select();
break;

}


thanks in advance for any help or advice.

Declan
 
Back
Top