如何在vb中创建警报弹出消息?

时间:2014-09-29 10:07:09

标签: asp.net vb.net visual-studio-2012 button popup

如何在单击按钮时在vb中创建弹出警报消息。 ?

非常感谢您的帮助!

这是我的页面加载代码如下:

Imports System.Net.Mail
Imports System.IO
Imports System.Text
Public Class locker
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Request.IsAuthenticated Then
            WelcomeBackMessage.Text = "Welcome back!"


             AuthenticatedMessagePanel.Visible = True
            AnonymousMessagePanel.Visible = True
        Else
            AuthenticatedMessagePanel.Visible = False
            AnonymousMessagePanel.Visible = True
        End If

        Dim ident As FormsIdentity = CType(User.Identity, FormsIdentity)
        Dim authTicket As FormsAuthenticationTicket = ident.Ticket
        WelcomeBackMessage.Text = "Welcome, " & User.Identity.Name & "!"

    End Sub


    Protected Sub send_Click(sender As Object, e As EventArgs) Handles send.Click
              <<<<----------popup message coded here------------>>>>>>>>>
    End Sub
End Class

2 个答案:

答案 0 :(得分:3)

如果您想弹出消息框,只需将其添加到按钮代码:

onclientclick="javascript:alert('Congratulations!');"

或者在后面的代码中:

Response.Write("<script language=""javascript"">alert('Congratulations!');</script>")

答案 1 :(得分:1)

Response.Write("<SCRIPT LANGUAGE=""JavaScript"">  alert('Complete');</script>")