tags:

views:

11

answers:

1

hi friends,

How to find the input text box is exit or no in my iframe html window using javascript

Now i using below code

if(document.getElementById('iframe').contentWindow.document.getElementById("INPUTBOX").value)
{
alert("Exist")
}
else
{
alert("NOT Exist")
}

But it gives me error "Object required"

+1  A: 

You need to remove the .value from the end of your if statement.

if(document.getElementById('iframe')
         .contentWindow.document.getElementById("INPUTBOX")) 
{ 
    alert("Exist");
} 
else 
{ 
    alert("NOT Exist"); 
}

The reason you are getting the "Object required" error is the input box doesn't exist on the page and you're still trying to access the value property. Accessing a property on a non-existent object will throw that error.

Andy E