JavaScriptの警告文を使用してメッセージダイアログボックスを作成しています。そのダイアログボックスにボタンが1つ含まれています。
JavaScript
<script language="javascript" >
function Confirmation() {
var win = window.open("", "_self");
if (confirm("Are you sure you want to close the form?") == true)
win.close();
else
return false
}
</script>
HTML
<td class="style5">
<asp:ImageButton ID="close" runat ="server" ImageUrl ="image/button_blue_close.png" OnClientClick="return Confirmation()"
Height="16px" Width="21px" ImageAlign="Right"/>
</td>
私のコードは私が画像ボタンをクリックしたときにウィンドウを閉じるだけです。しかしダイアログボックスのボタンクリックでウィンドウを閉じたい
my code in vb.net
-----------------
ClientScript.RegisterStartupScript(Me.GetType(), "message", "alert("Please Raise the ticket for particular event");", True)
回答:
回答№1は0親ウィンドウを閉じたい場合は、このようにコードを変更する必要があります。
`<script language="javascript" >function Confirmation(){if (confirm("Are you sure you want to close the form?") == true) window.opener.close();else return false;}</script>`
回答№2の場合は0
私はあなたがきちんと質問することを理解したならば、あなたは欲しいダイアログボックスから親ウィンドウを閉じる。あなたが書いたコードはあなたの親ウィンドウではなくあなたのダイアログボックスを閉じるでしょうが。親ウィンドウを閉じるには、以下のコードを使用できます。
window.opener.close();