開いている Web ページ ダイアログがあります。そこから、私がやりたいことは、ユーザーがリンクをクリックしたときに、変更されたクエリ文字列パラメーターでダイアログの内容を更新することです。私が直面している問題は、同じ Web ページを新しいパラメーターで更新するのではなく、新しいブラウザー ウィンドウがポップアップすることです。
ダイアログを開くために使用するページは次のとおりです。
<!DOCTYPE html>
<html>
<head>
<title></title>
<script type="text/javascript">
function ShowPopup() {
var popWinFeatures = "dialogWidth: 800px;dialogHeight:600px;center:yes;status:no;scroll:no;resizable:yes;help:no";
window.showModalDialog("webPageDialog.html","PopUpWin",popWinFeatures);
}
</script>
</head>
<body>
<a href="#" id="openWebPageDialog" onclick="ShowPopup()">Click For Modal</a>
</body>
</html>
これは、変更されたクエリ文字列パラメーターで Web ページを更新しようとする Web ページ ダイアログ内のコードです。
<!DOCTYPE html>
<html>
<head>
<title></title>
<script src="scripts/jquery-1.6.4.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
var queryString = "?ab=123";
var newURL = window.location.protocol + "//" + window.location.host + "/" + window.location.pathname;
$('#testLink').attr('href', newURL+queryString);
});
</script>
</head>
<body>
<a href="#" onclick="" id="testLink" target="_self">Please Click Me</a>
</body>
</html>
window.open
設定だけでなく、使用も試しましwindow.location
た。また、設定も試しましwindow.location.href
たが、結果は同じでした。
新しいブラウザ ウィンドウには、期待どおりのものが表示されます。同じウィンドウにないだけです。
考え?