How can I get the 'width' and 'height' of an
| 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());
}