5 document.getElementById('log').appendChild(document.createTextNode(msg + '\n'));
9 if (window.testRunner) {
10 testRunner.dumpAsText();
13 window.onfocus = function() { log('main frame focused'); }
14 window.onblur = function() { log('main frame blurred'); }
16 var input = document.getElementsByTagName('input')[0];
17 input.onfocus = function() { log('<input> focused'); }
18 input.onblur = function() { log ('<input> blurred'); }
20 var w = document.getElementById('frame').contentWindow;
21 w.onfocus = function() { log('iframe focused'); }
22 w.onblur = function() { log('iframe blurred'); }
24 var inputInIframe = w.document.getElementsByTagName('input')[0];
25 inputInIframe.onfocus = function() { log('<input> in iframe focused'); }
26 inputInIframe.onblur = function() { log ('<input> in iframe blurred'); }
29 inputInIframe.focus();
34 <body onload="test()">
36 <iframe id="frame" src='javascript:"<input>"' style="width: 100px; height: 100px; margin: 0px; border: 2px solid black;"></iframe>
37 <p>This page tests that frames receive focus events when one of their child
38 elements is programmatically focused, and receive blur events when an
39 element not in that frame is programmatically focused.</p>