Update Text Inside Page With Image

I am working with Delphi7 and TEmbeddedWB. I have some difficulty to update text of a page in twebbrowser. Because that webpage contains images. So Complete Html code is

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">'#$D#$A'
<HTML>
    <HEAD>'#$D#$A'
        <META content="text/html; charset=windows-1252" http-equiv=Content-Type>'#$D#$A'
        <META name=GENERATOR content="MSHTML 8.00.7601.17514">
    </HEAD>'#$D#$A'
    <BODY>'#$D#$A'
       <DIV align=center><**IMG '#$D#$A'src="file:///C:/Program%20Files/image/c.jpg"></DIV>
       <FONT '#$D#$A'size=2 face=Arial><SPAN style="FONT-FAMILY: Arial; FONT-SIZE: 10pt">'#$D#$A'<P>**Hello «Forename», '#$D#$A'thiss<BR><BR><BR>«signature»<BR>**</P></SPAN></FONT>
    </BODY>
</HTML>'#$D#$A.

So I need to update only text like from (Hello «Forename» this «signature») to (this is a demo page). When I go to set Doc.Body.innerText := this is a demo page. Then On showing page image does remove, only text is display.

Please tell me how would be update text inside page with image. Please help me

Answers:

Answer

Maybe you can use the StringReplace function of Delphi to replace the text in the HTML of the browser, so something like:

Doc.Body.innerHTML := StringReplace(Doc.Body.innerHTML, '«signature»', 'Your Signature', []);

innerHTML should return the body contents, including all elements, while innerText only gets the text, without markup.

A nicer way would be to use methods like getElementById and other similar methods that you have available in e.g. Javascript, but I don't know if those methods are exposed by TEmbeddedWB.

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.