2

Starting with this BHO article in C#. Tried setting the styles but it doesn't set (I don't see any change in the HTML or noticeable changes).

Tried in the OnBeforeNavigate and in the OnDocumentComplete. Is there another place I should be making these type of changes?

foreach (IHTMLElementtempElement tempElement in document.getElementsByTagName("INPUT"))
{
    IHTMLInputElementinput input=(IHTMLInputElement) tempElement;

    if(input.type.ToLower().Contains("password"))
    {
        System.Windows.Forms.MessageBox.Show("OnBeforeNavigate:"+input.value);

        tempElement.setAttribute("style", "(some styles here);",0);
    }
}
user2685937
  • 115
  • 1
  • 6
  • I think you forgot a variable declaration in the 1st and 3rd line. – Vitor Canova Jul 03 '14 at 15:26
  • You should replace "(some styles here);" with the real string you used (and try in OnDocumentComplete, not OnBeforeNavigate) – manuell Jul 08 '14 at 09:50
  • I've tried many different styles but nothing changes in the display or resulting html. Let's say style="color:green;" if it helps, doesn't show in the resulting html not visually and is not seen in view source. I've noticed input.value="anything" does work and sets the password, but nothing seems to set an attribute. – user2685937 Jul 08 '14 at 23:43

1 Answers1

0

The IHTMLElement interface has a style property, which gives you an IHTMLStyle interface, which in turn has many properties, like color or font.

manuell
  • 7,528
  • 5
  • 31
  • 58