Display MessageBox in ASP

前端 未结 4 576
面向向阳花
面向向阳花 2020-12-17 22:08

I am new to code and starting with ASP. How do I create a simple message box so I can alert the users on the web page?

相关标签:
4条回答
  • 2020-12-17 22:34

    If you want to do it from code behind, try this:

    System.Web.UI.ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "AlertBox", "alert('Message');", true);
    
    0 讨论(0)
  • 2020-12-17 22:44

    Here is one way of doing it:

        <%
           Dim message    
           message = "This is my message"
           Response.Write("<script language=VBScript>MsgBox """ + message + """</script>") 
        %>
    
    0 讨论(0)
  • 2020-12-17 22:52
    <!DOCTYPE html>
    <html>
    <body>
    <button onclick="myFunction()">Try it</button>
    
    <script>
    function myFunction()
    {
        alert("Hello!");
    }
    </script>
    
    </body>
    </html>
    

    Copy Paste this in an HTML file and run in any browser , this should show an alert using javascript.

    0 讨论(0)
  • 2020-12-17 22:58
    <% response.write("<script language=""javascript"">alert('Hello!');</script>") %>
    
    0 讨论(0)
提交回复
热议问题