6 var console
= document
.getElementById("console");
7 console
.appendChild(document
.createTextNode(message
+ "\n"));
9 function testFrame(name
)
12 var doc
= frame
.document
;
13 var target
= doc
.getElementById("target");
14 log(name
+ ": body: (" + doc
.body
.offsetLeft
+ ", " + doc
.body
.offsetTop
+ ")" +
15 " child: (" + target
.offsetLeft
+ ", " + target
.offsetTop
+ ")");
19 if (window
.testRunner
)
20 testRunner
.dumpAsText();
23 testFrame("relative");
25 testFrame("absolute");
29 iframe { border: thin solid; height:
100px; }
32 <body style=
"padding: 9px; margin: 10px" onload=
"test()">
33 <pre id=
"console"></pre>
35 <iframe name=
"static" src='data:text/html,
36 <body style=
"padding: 9px; margin: 10px; outline: thin solid blue;">
37 <div id=
"target" style=
"padding: 6px; margin: 8px; outline: thin solid green;"></div>
44 <iframe name=
"relative" src='data:text/html,
45 <body style=
"position: relative; left: 12px; width: 150px; padding: 9px; margin: 10px; outline: thin solid blue;">
46 <div id=
"target" style=
"padding: 6px; margin: 8px; outline: thin solid green;"></div>
53 <iframe name=
"fixed" src='data:text/html,
54 <body style=
"position: fixed; left: 12px; padding: 9px; margin: 10px; outline: thin solid blue;">
55 <div id=
"target" style=
"padding: 6px; margin: 8px; outline: thin solid green;"></div>
62 <iframe name=
"absolute" src='data:text/html,
63 <body style=
"position: absolute; left: 12px; padding: 9px; margin: 10px; outline: thin solid blue;">
64 <div id=
"target" style=
"padding: 6px; margin: 8px; outline: thin solid green;"></div>