views:

28

answers:

3

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 and it would display the change on the screen)

A: 

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.

Mitchel Sellers
+1  A: 

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

Luuk van Rens
+1  A: 

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.

Matt Ball