Questo programma dovrebbe impostare le caselle di testo su una pagina html (che sta suo mio HD) ma non funziona bene.
Programma delphi:
codice:
function GetElementByName(doc: IHTMLDocument2 ;name: string):IHTMLElement;
begin
Result:=(doc.all.item(name,0) as IHTMLElement);
end;
var D:IHTMLDocument2; E:IHTMLElement;
begin
W.Navigate(PATH+'prova.html');
while (W.Busy) do begin Application.ProcessMessages end;
d:=(W.Document as IHTMLDocument2);
E:=GetElementByName(d,'user');
E.innerText:='test';
E:=GetElementByName(d,'password');
E.innerText:='test2';
e quello della pagina html:
codice:
<html>
<body>
<form name="f" method="post">
Nome:<input type="text" name="user" size="30" MAXLENGTH="30">
Password:<input type="password" name="password" size="20" MAXLENGTH="20">
</form></body></html>
L'errore lo da alla riha "e.innertext" perchè E risulta nil..
Come mai?? Grazie