[fpc-pascal] How to use GetElementById?
silvioprog
silvioprog at gmail.com
Wed Jan 26 22:57:29 CET 2011
Hi guys,
I use the GetElementById in PHP with sucess, but in FPC I not know how use.
In PHP I use (with sucess):
...
$dom = new DOMDocument();
@$dom->loadHTML($data);
$return = @$dom->getElementById('currency_converter_result')
->getElementsByTagName('span')->item(0)->firstChild->wholeText;
...
In FPC I try (but without sucess):
...
var
VHTMLDocument: THTMLDocument = nil;
begin
try
ReadHTMLFile(VHTMLDocument, '../HTML/index.htm');
ShowMessage(VHTMLDocument.GetElementById('currency_converter_result'
).GetElementsByTagName('span').Item[0].FirstChild.TextContent);
...
I found a 'generic' solution:
....
ShowMessage(VHTMLDocument.GetElementsByTagName('div').Item[5].TextContent);
// This is a unique alternative? :o
....
Any idea? The GetElementById function works? :/
Project to reproduce my problema in attached (with the HTML and PHP files).
( sorry for my bad english ^^' )
Thanks.
--
*Silvio Clécio*
*Blog.* blog.silvioprog.com.br
*Twitter.* twitter.com/silvioprog
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20110126/b7d671ec/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: GetElementById_BUG.zip
Type: application/zip
Size: 7680 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20110126/b7d671ec/attachment.zip>
More information about the fpc-pascal
mailing list