I'm having trouble to set a new attribute to the element, VS 2005 returns me the following error on the code below:
Error 1 No overload for method 'setAttribute' takes '2 'arguments Error 2 No overload for method 'setAttribute' takes '2 'arguments Error 3 No overload for method 'setAttribute' takes '2 'arguments
some of what can be the problem?
Thank you!
try
{
IHTMLElementCollection AllElements = document.all;
foreach (IHTMLElement Element in AllElements)
{
if (Element.tagName.ToUpper() == "IMG")
{
if (Element.offsetHeight <= 40 && Element.offsetHeight >= 20)
{
if (Element.offsetWidth <= 160 && Element.offsetWidth >= 130)
{
Element.setAttribute("width", Element.offsetWidth);
Element.setAttribute("height", Element.offsetHeight);
Element.setAttribute("src", "images/newimage.png");
}
}
}
}
}
catch (Exception e)
{
string erro = e.Message;
System.Windows.Forms.MessageBox.Show(erro);
}