开发者

org.w3c.dom: get element's height and width?

开发者 https://www.devze.com 2023-02-14 19:28 出处:网络
I have loaded a org.w3c.dom dom document on to the component. I want to get each element开发者_开发知识库 to highlight.

I have loaded a org.w3c.dom dom document on to the component.

I want to get each element开发者_开发知识库 to highlight.

For example, on mouseover, I would get the element from this point and then get the dimension of this element so that I can create a Jframe on top of this element with a colored border.

Is it possible to get an element's height and width?


The DOM API doesn't really handle HTML or rendering, it's a pure representation of the elements of an XML element.

Those elements have no inherent size (or color, or z-index, ...).

If you want that information, you'd need to have some component that actually renders your document (or at least produces a layout that could be rendered).

Is there such a component in your application? Is your code running as an Applet in a browser?

0

精彩评论

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

关注公众号