This small javascript function will help you to check if a HTML object.Element exists in a page from the page itself or from a popup window.


function chkObject(inParent,theVal) {
if(inParent){
if (window.opener.document.getElementById(theVal) != null) {
return true;
} else {
return false;
}
}else{
if (document.getElementById(theVal) != null) {
return true;
} else {
return false;
}
}
}

Note:
chks whether an object exists or not in the document.
if the inParent is true then the object/elt is checked for its existence in the parent/opener’s document.
i.e., it will be useful to chk from a popup window.
To check in the current document itself , then set inParent value as false.

Be Sociable, Share!