开发者

How to insert Html anchor Tag around a specific word in C# webbrowser

How to linkify a specific word in C# webbrowser on OnDocumentComplete event. I want to linkfy all the words say 'hemant' to hemant appears in the document in my c# browser. How to just add the anchor ta开发者_JAVA百科g around any specific word using onDocumentComplete event?


You need to grab the HtmlDocument from the browser control and iterate the DOM and modify it.

Examples on using HtmlDocument can be found at MSDN.

For iterating all elements check out the All property. For each HtmlElement check innerText or innerHTML for your word, and change accordingly to wrap it with an anchor.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜