I have gone through some HTML tutorials and now have a very simple HTML
file that when open in a browser will select one of the four paragraphs in
the document and write it to the screen.  I also have a simple VFP program
that loads an instance of IE and loads the same HTML file.  That program
then reports how many paragraphs are in the file but I have not been able
to get it to let me pick a single paragraph for output.  I am fairly
confident that what I want to do is possible but I have never gotten past
that line without an error.

Any help will be greatly appreciated! - Joe

Here is the HTML file:

<!DOCTYPE html>
<html>
<body>

<p id="demo1">Click the 1st button to change the text in this paragraph.</p>
<p id="demo2">Click the 2nd button to change the text in this paragraph.</p>
<p id="demo3">Click the 3rd button to change the text in this paragraph.</p>
<p id="demo4">Click the 4th button to change the text in this paragraph.</p>

<button onclick="myFunction()">Try it</button>

<script>

function myFunction()
{
document.write(document.getElementsByTagName("p")[2].innerHTML);
};

</script>

</body>
</html>


Here is the VFP program:

LOCAL ;
  loIE as InternetExplorer.Application,;
  lnIndex

* Load an instance of IE
  loIE = CREATEOBJECT("InternetExplorer.Application")
  loIE.Visible = .T.

* Tell IE to load a page
  =loIE.Navigate (Full path to te HTML file)

* Wait for action to complete and clearing the browser scripting block
  WAIT WINDOW 'Allow scripting on browser then click'

* Display the number of paragraphs in the document
  ? loIE.document.getElementsByTagName("p").length, 'Paragraphs found'

* Display the inner HTML of the third paragraph
  ? loIE.document.getElementsByTagName("p")[2].innerHTML

  loie.Quit
  RETURN


--- StripMime Report -- processed MIME parts ---
multipart/alternative
  text/plain (text body -- kept)
  text/html
---

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/CABQeDnWmv+ovv63w7=4bernflqnee+kpzvgrbjs4hpfekoo...@mail.gmail.com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to