المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : How to set 'innerText' property of an HTMLElement?



C# Programming
05-28-2009, 09:20 AM
I had a small application of BHO which retreives each and every element of a web page opened in IE.
I want to change the text that is visible on web page, as the changed text should be directly visible

to user instead of original text.
How can I do this in c#?If I try to change/assign the innerText of an HTMLELement in the following

ways, the original text is visible for a fraction of seconds initially, and then it is replaced by the

"New text".


1. htmlElement.innerText = htmlElement.innerText.Replace(htmlElement.innerText, "New Text");

2. htmlElement.innerText = "New Text";





If I try to set the innertext property in the following way

object obj = "New text";
htmlElement.setAttribute("innerText", obj,0);

it doesn't show any effect,
I think I was missing something. How can I do this?