blob: 716afb6997c89efb9b117125aec7bf6be398a695 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
---
title: Document.getBoxObjectFor()
slug: Web/API/Document/getBoxObjectFor
tags:
- API
- Boîte
- DOM
- Méthodes
- Objets
translation_of: Web/API/Document/getBoxObjectFor
---
{{ ApiRef("DOM") }} {{obsolete_header}}
Renvoie un `boxObject` (x, y, largeur, hauteur) pour un élément spécifié.
> **Note :** Cette méthode est obsolète. Vous devez utiliser la méthode {{domxref("element.getBoundingClientRect()")}} à la place.
## Syntaxe
boxObject = document.getBoxObjectFor(element);
- `boxObject` est un {{interface("nsIBoxObject")}}.
- `element` est un {{domxref("element","DOMElement")}}
## Exemple
```js
var myDiv = document.getElementById("myDiv"),
boxObj = document.getBoxObjectFor (myDiv);
alert (
"x:" + boxObj.x +
", y:" + boxObj.y +
", Width:" + boxObj.width +
", Height:" + boxObj.height
);
```
## Notes
Spécifié dans [nsIXULDocument.idl](http://mxr.mozilla.org/mozilla-central/source/dom/interfaces/xul/nsIDOMXULDocument.idl)
|