Wrong Window
Wrong Window
Hello,
I have a problem which only happens in IE and just wanted to ask for a
quick sense check before I submit a bug.
I am creating an iframe, for which I get the window object and attach
a handler to the blur event.
When the event fires the 'this' in the function refers to the main
window, not the iframe window.
Here is the code
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Window bug</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-
latest.min.js"></script>
<script type="text/javascript">
$(window).load(function() {
$(document.body).append("<iframe name='otherWindow'
scroll='yes' src='about:blank'>");
var otherWindow = window.frames["otherWindow"].window;
$(otherWindow).blur(function() {
alert(this.name);
});
});
</script>
</head>
<body>
</body>
</html>
when you run this in FF, click on the iframe and away, and you get a
popup saying otherWindow.
in ie you get a blank popup, the main window.
Has anyone seen this before?
Is it a known bug?
Shall I have salad in my ham sandwich or extra ham?
Ant