Javascript: Strange Problem loading a variable

Hi, I ve the follow code:

var xmlDoc=new ActiveXObject(“…”)

xmlDoc.load(“…”)

//xmlDoc.async="false"

var x = xmlDoc.getElementsByTagName(“…”) <<— line Y

var result = x.item(0).text <<— line X

if(“…” != resul)

{

alert('Access Denied');

window.parent.location = \"?logout\";}

else

alert('Wellcome)');

When I try to load this code through a browser (in the X line) raise an error, “The data necessary to complete this operation is not available yet” in the bottom left corner. It reference to line “X”.

But when I write “alert(x)” between line “Y” and line “X” the var “result” is loaded OK.

Note: I can’t write any alert message in this code.

Any suggestion to solve this problem?

Thanks a lot !! It´s driving me crazy.

Santiago.

Subject: Javascript: Strange Problem loading a variable

Most of the time, the error “The data necessary to complete this operation is not available yet” is thrown because you are trying to perform an action on xmlDoc and not setting async = ‘false’. I see it commented out in your code.

I also wouldn’t get x.item(0).text without knowing if x has item(0) first.

HTH

Patrick