How can I get the 'width' and 'height' of an

"[email protected]" <[email protected]>
Newsgroups gmane.comp.mozilla.devel.dom
Organization http://groups.google.com
Message-ID <[email protected]>
Hi,

I use the following code to get and print the width and height
attribute of a nsIDOMNSHTMLElement.

But I only get 'empty' string.   I am sure that the source has 'width'
and 'height' attribute.  Can you please tell me what am i missing?

Thank you.


    nsIDOMNSHTMLElement* element;

   nsCOMPtr<nsIDOMElement> domElement = do_QueryInterface(element);

    if (domElement) {
      nsAutoString width;
      nsAutoString height;

      domElement->GetAttribute(NS_LITERAL_STRING("width"), width) ;
      domElement->GetAttribute(NS_LITERAL_STRING("height"), height) ;

      printf("w:%s:\n", width.get());
      printf("h:%s:\n", height.get());

}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.