Subject: Reading Array from DOM
Posted By: hm1492 Post Date: 2/7/2004 2:31:22 PM
My question is where in the IE DOM is the variable exposed? Put another way, I want to read the value of an element in the array but can't seem to find it in the DOM.

In the following code I create an instance of IE within VFP, load the document with a simple page (also shown below "test.htm") that contains some script code. The script includes an array. (I assume the same answer will work in any language - Java, C#, VB...).

oIE=CREATEOBJECT('internetexplorer.application')
oIE.Navigate='test.htm'
oIE.Visible = .t.

* thie following does not work and the question is what does?
? oIE.document.aTest.1

**** test.htm

<html>
<head>
<script language="javaScript">
var aTest = new Array(2)
aTest[0]='test0'
aTest[1]='test1'
aTest[2]='test2'
</script>
</head>
<body>
hello world
<script>alert(aTest[1])</script>
</body>
</html>

Thanks in advance to anyone that has any clues! <g>


Reply By: joefawcett Reply Date: 2/7/2004 3:27:15 PM
Not sure what you want. To access array in this instance you need parentWindow.atest but your code seems wrong to start with. Assuming you are running a stand alone script:

var oIE = new ActiveXObject("InternetExplorer.Application");
oIE.navigate("test.htm");
while(oIE.readyState != 4)
{
  WScript.sleep(500);
}
oIE.visible = true;
WScript.echo(oIE.document.parentWindow.atest[1]);




--

Joe
Reply By: hm1492 Reply Date: 2/9/2004 1:06:07 PM
Thanks but the problem seems to be within Visual FoxPro not being able to read array collections.

I tried your "parentWindow" suggestion and it returned the same results and I was seeing in my original example.  I get a message that reads "Command contains unrecognized phrase/keyword."  This is some sort of internal VFP message.  The intelisense shows the zero and one members but that is as close as it gets.

So thanks for your help. I'm going to pass this one on to MS and see if they can find the problem.

--Harvey


Go to topic 9569

Return to index page 952
Return to index page 951
Return to index page 950
Return to index page 949
Return to index page 948
Return to index page 947
Return to index page 946
Return to index page 945
Return to index page 944
Return to index page 943