Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Reading Internet Explorer variables
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00875074
Message ID:
00876214
Vues:
17
Hi Harvey,

You'll need to use the Script object and create a function to access your variables cos I haven't been able to access the vars directly.
oIE=CREATEOBJECT('internetexplorer.application')
oIE.Navigate('D:\temp\test.htm')
?oie.Document.script.getarrayvalue("aTest","1")

test.htm
<html>
<head>
<script language="javaScript">
var aTest = new Array(2)
aTest[0]='test0'
aTest[1]='test1'
aTest[2]='test2'
function getarrayvalue(cVar,cId)
{
   return eval(cVar+"["+cId+"]");
}
</script>
</head>
<body>
hello world
</body>
</html>
Hope this helps,
Sylvain

>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.
>
>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.
>
>
>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>
>
>
>#### eof
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform