複数のフレームにまたがる必要があるポップアップ ウィンドウがあるため、これを機能させるために window.createPopup を使用しています。(IE6、7、8)
以下は、ポップアップを作成するために使用している関数です。
function ShowMyPopup() {
notificationPopup = window.createPopup();
$(notificationPopup.document.body).load("/notification.html");
notificationPopup.show($(sourceFrame.document.body).width() - 510, $(sourceFrame.document.body).height() - (510 - $(sourceFrame.document.body).height()), 500, 500, sourceFrame.document.body);
}
これはかなりうまくいくようです。ポップアップウィンドウが表示されます。問題は、私が何をしても、結果のポップアップ ウィンドウで DOM 要素にアクセスできないように見えることです。私はさまざまな jQuery メソッドとまっすぐな getElementById を試しましたが、すべて NULL を返します。以下は、notification.html の内容です。
<html>
<head>
<script type="text/javascript">
$(document).ready(function () {
alert($(document).html());
alert($("#divNotification").html());
alert(document.getElementById("divNotification"));
});
</script>
</head>
<body>
<div id="divNotification" onclick="$(this).toggle();">
<h3>Some Notification!</h3>
Testing 1234...
</div>
</body>
</html>
3 つのアラートが表示されるので、jQuery が機能していることはわかりますが、3 つのアラートはすべて単に「NULL」と表示されます。結果の div をクリックすると、onClick が起動しますが、"Object Expected" エラーが発生します。
ここで何が起こっているのですか?