PDA

View Full Version : Read a value from webbrowser ?


delphiest
06-01-2008, 02:57 AM
Hi

I use always a value from Webbrowser so :


Edit1.Text:=WebBrowser1.OleObject.document.forms.i tem(0).elements.item('the_number').value;


But this time, it does not work!
here is my html code of the table1 (but in html there are 2 tables) :
mere is the Table1 (the value is inside of this table) :

<div style="position: absolute; float: left; left: 94px; top: 78px; width: 688px; height: 96px">
<table border="1" width="655" style="border-collapse: collapse" height="81">
<tr>
<td width="407" height="41" align="center">
*</td>
<td width="49" height="41" align="center">
*</td>
<td align="right" width="108" rowspan="2">
<p align="center">
*<td width="31" height="81" rowspan="2">
<p align="center">
*</td>

<td width="40" height="81" rowspan="2">
<p align="center">
</td>

</tr>
<tr>
<td width="407" height="41" align="center">
*</td>
<td width="49" height="41" align="center">
<input name="the_number" size="4" style="float: left" value="999"></td>

</tr>
</table>
</div>

develyoy
06-03-2008, 06:39 AM
please give the HTML with one (or both?) <form> elements! since forms(0) will take only <input> elements in the first <form>

delphiest
06-03-2008, 07:06 AM
Tahnks
when I put my html code between <form></form> so I can get the value :
Edit1.Text:=WebBrowser1.OleObject.document.forms.i tem(0).elements.item('the_number').value;

It works

must I put my html code between <form></form> ?
How can I reed the Value when I have no form in html-Code ?
Or ist not possible ?

thanks

best regards

develyoy
06-03-2008, 11:25 AM
in valid HTML <input> elements should occur within a <form> element, but most browsers to show them without.

If you use a <form> element, use <form onsubmit="return false;">, to prevent the page from posting when the user presses enter.

If you don't use <form>, use id="", not name="", and use document.getElementById()

delphiest
06-03-2008, 12:51 PM
Thanks
it works withot <form>
WebBrowser1.OleObject.Document.GetElementByID('tel ephone').Value := Edit1.Text;

best regards