无法使用 Java 脚本隐藏模式弹出窗口

Not able to hide modal popup using Java Script

提问人:Manish Kumar 提问时间:9/12/2023 最后编辑:Black catManish Kumar 更新时间:9/14/2023 访问量:29

问:

'我使用了模态弹出窗口,它在按钮关闭事件中工作正常,但不适用于 JavaScript 。请帮我解决这个问题。'

This My script

<script>

 window.onload = function () {
 setInterval(function () {
 $("#btnclose").click().
 }, 3000);
 }

</script> 

this my modal popup that i have used

 <div id="myModal" visible="false" runat="server" class="modal">
 <div id="modalcontent1" runat="server" class="modal-content">
 <div id="modalheader1" runat="server" class="modal-header">
 <h3>Message<br />
 </h3>
 </div>
<div id="madalbody1" runat="server" class="modal-body">
<p style="height: 60px; margin: 7px">
<asp:Label ID="lblMsg" runat="server" Text=""></asp:Label>
</p>
</div>
<div id="modalfooter1" runat="server" class="modal-footer">
 <h3>
 <asp:Button ID="btnclose" CausesValidation="false" runat="server"   CssClass="allBtn blue" Text="CLOSE" />
 </h3>
 </div>
 </div>
</div>

I am using this as of now but for show and hide modal and now i need to do that with JavaScript

    Protected Sub btnclose_Click(sender As Object, e As EventArgs)
     myModal.Visible = False
    myModal.Dispose()    
    End Sub
    
    Protected Sub displayMessage(msg As String)
    lblMsg.Text = ""
    myModal.Visible = True
    myModal.Style.Add("display", "block")
    lblMsg.Text = msg
    End Sub
JavaScript Java asp.net vb.net

评论

0赞 Konrad 9/12/2023
如果没有用户实际点击,您就无法单击任何内容
0赞 Manish Kumar 9/12/2023
@Konrad 如果分享任何建议或示例,我该如何做同样的事情.我已经在我的VB代码中使用了上面提到的。

答: 暂无答案