3 function sizeResizer() {
5 var img
= document
.getElementsByTagName("img")[0];
7 var textarea
= document
.getElementsByTagName("textarea")[0];
8 var width
= 200 - textarea
.clientWidth
;
9 var height
= 200 - textarea
.clientHeight
;
10 // (Leave test failing if a scrollbar is missing)
11 if (width
!= 0 && height
!= 0) {
12 img
.style
.width
= width
+ "px";
13 img
.style
.left
= textarea
.clientWidth
+ "px";
14 img
.style
.height
= height
+ "px";
15 img
.style
.top
= textarea
.clientHeight
+ "px";
19 <body onload=
"sizeResizer()">
20 <textarea style=
"width: 200px; height: 200px; margin: 0; border: none;
21 background: red; font-size: 400px;">
24 <div style=
"position: relative; top: -200px;
25 width: 200px; height: 200px; margin: 0; border: none;
26 background: lightgreen">
27 <img style=
"position: relative;" src=
"chrome://global/skin/icons/resizer.svg">