| document.getElementById('log').appendChild(document.createTextNode(msg + '\n')); |
| window.onfocus = function() { log('main frame focused'); } |
| window.onblur = function() { log('main frame blurred'); } |
| var input = document.getElementsByTagName('input')[0]; |
| input.onfocus = function() { log('<input> focused'); } |
| input.onblur = function() { log ('<input> blurred'); } |
| var w = document.getElementById('frame').contentWindow; |
| w.onfocus = function() { log('iframe focused'); } |
| w.onblur = function() { log('iframe blurred'); } |
| var inputInIframe = w.document.getElementsByTagName('input')[0]; |
| inputInIframe.onfocus = function() { log('<input> in iframe focused'); } |
| inputInIframe.onblur = function() { log ('<input> in iframe blurred'); } |
| <iframe id="frame" src='javascript:"<input>"' style="width: 100px; height: 100px; margin: 0px; border: 2px solid black;"></iframe> |
| <p>This page tests that frames receive focus events when one of their child |
| elements is programmatically focused, and receive blur events when an |
| element not in that frame is programmatically focused.</p> |