开发者

How to read the html contents of the web browser control?

开发者 https://www.devze.com 2022-12-22 10:45 出处:网络
How to (i) read the html contents of the web browser control (ii) modify it and (iii) redisplay it on the screen?

How to (i) read the html contents of the web browser control (ii) modify it and (iii) redisplay it on the screen?

(simular to firebug, http://getfirebug.com/ where you can load a webpage, change the html tag value a开发者_运维百科nd it would display the change on the screen)


javascript:


//put this content in a textarea
document.getElementById("textareaid").value = document.getElementById("controlid").innerHTML;


//save button does
document.getElementById("controlid").innerHTML = document.getElementById("textareaid").value;

tadaa


There is a DocumentText property on the Web Browser Control, this allows you to read and write the current HTML document that is displayed.

You can read from this, update the text, then set the property to update the display to the users.

For reference, the MSDN documentation outlines all Members for the WebBrowser control.


How about looking at the source code for Firebug? In some ways, its HTML editing is just a fancy UI for the standard DOM functions.

0

精彩评论

暂无评论...
验证码 换一张
取 消