Javascript 如何触发从iFrame到对话框的单击
标题听起来可能令人困惑。在我的主aspx页面上,当警报处于活动状态(来自数据库查询)时,将启动一个弹出窗口。弹出窗口是另一个页面(带有参数的alarm.aspx)。警报按如下方式启动:Javascript 如何触发从iFrame到对话框的单击,javascript,asp.net,Javascript,Asp.net,标题听起来可能令人困惑。在我的主aspx页面上,当警报处于活动状态(来自数据库查询)时,将启动一个弹出窗口。弹出窗口是另一个页面(带有参数的alarm.aspx)。警报按如下方式启动: function showAlarm(AlarmURL) { spawn(function*() { var ret = window.showModalDialog(AlarmURL, "", "dialogWidth:500px;dialogHeight:400
function showAlarm(AlarmURL)
{
spawn(function*() {
var ret = window.showModalDialog(AlarmURL, "", "dialogWidth:500px;dialogHeight:400px");
});
}
该功能来自:
创建模式对话框时,会在主页中创建以下内容:
<dialog style=Width:500px;Height:400px" open=""><a href="#" id=dialog-close" style="position:absolute;top:0;right:5px;font-size:20px;color:#000;text-decoration:none;outline:none;">x</a>
<iframe id="dialog-body" src="Alarm.aspx?ID=322654" steyle="border:0;width=100%;"></iframe>
</dialog>
Private Sub cmdOK_Click(ByVal sender as System.Object, ByVal e as System.EventArgs) Handles cmdOK.Click
'Querying the Database here, QueryExecute
'Something I tried that didn't work
ClientScript.RegisterStartupScript(GetType(Page), "Close", "<script language='javascript'>document.querySelector('#dialog-body').contentWindow.document.querySelector('#dialog-close').click();</script>")
End Sub