views:

35

answers:

1

In HTML, I have an object tag as follows:

<OBJECT ID="objectid" CLASSID="some-class-id" CODEBASE="some-codebase">

I have written a function in JavaScript to access this object.

I checked the null value as follows:

if(objectid==null){-----}

i want to check if the object is undefined or is empty. Do we have any functions to check so?

+1  A: 

To check if a variable contains a value and exists, use:

if (variable) {}

For example, to check that you have obtained the objectid DOM element:

if (document.getElementById("objectid")) {}

Steve Harrison