Display alert or messages to the user.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Marge

    #1

    Display alert or messages to the user.

    This may be in the wrong forum, but here goes.

    How can I display an alert in the users browser window from an asp page.

    For example, a welcome message. I know I can do this with response.write,
    but I'd like to have a general method of displaying messages to the user.

    Thanks a lot all.


  • Marge

    #2
    Re: Display alert or messages to the user.

    I meant to add this in the post. I've tried using this code, but nothing
    happens:

    <%
    msg = "Just a Test Message"
    Response.Write( "<" & "script language=VBScri pt>")
    Response.Write( "MsgBox """ & msg & """<" & "/script>")
    %>


    "Marge" <mpeg@yahoo.caw rote in message
    news:ONqwyvrOJH A.4776@TK2MSFTN GP05.phx.gbl...
    This may be in the wrong forum, but here goes.
    >
    How can I display an alert in the users browser window from an asp page.
    >
    For example, a welcome message. I know I can do this with response.write,
    but I'd like to have a general method of displaying messages to the user.
    >
    Thanks a lot all.
    >
    >

    Comment

    • Tim Slattery

      #3
      Re: Display alert or messages to the user.

      "Marge" <mpeg@yahoo.caw rote:
      >I meant to add this in the post. I've tried using this code, but nothing
      >happens:
      >
      ><%
      msg = "Just a Test Message"
      Response.Write( "<" & "script language=VBScri pt>")
      Response.Write( "MsgBox """ & msg & """<" & "/script>")
      >%
      <%msg="Just a Test Message" %>
      <script type="text/javascript">
      alert("<%=msg%> ");
      </script>

      --
      Tim Slattery
      MS MVP(Shell/User)
      Slattery_T@bls. gov

      Comment

      • Evertjan.

        #4
        Re: Display alert or messages to the user.

        Marge wrote on 30 okt 2008 in microsoft.publi c.inetserver.as p.general:
        "Marge" <mpeg@yahoo.caw rote in message
        news:ONqwyvrOJH A.4776@TK2MSFTN GP05.phx.gbl...
        >This may be in the wrong forum, but here goes.
        >>
        >How can I display an alert in the users browser window from an asp
        >page.
        >>
        >For example, a welcome message. I know I can do this with
        >response.write , but I'd like to have a general method of displaying
        >messages to the user.
        [Please do not toppost on usenet]
        I meant to add this in the post. I've tried using this code, but
        nothing happens:
        >
        <%
        msg = "Just a Test Message"
        Response.Write( "<" & "script language=VBScri pt>")
        Response.Write( "MsgBox """ & msg & """<" & "/script>")
        %>
        Your clientside vbscript, if it works, then only on IE.

        Try:


        message = "Hello world"
        %>
        <script type='text/javascript'>
        alert('<% = message %>');
        </script>
        <%



        --
        Evertjan.
        The Netherlands.
        (Please change the x'es to dots in my emailaddress)

        Comment

        • Marge

          #5
          Re: Display alert or messages to the user.

          Thanks Evertjan and Tim. I got no alert nor did I get any error message.
          Here is a code fragment that I am using. Perhaps your keen eyes will see
          where this little fool is messing up:

          If UCase(strStatus ) = "PENDING" Then

          strMSG = "You must complete the following form!"

          %>
          <script type='text/javascript'>
          alert('<% = strMSG %>');
          </script>
          <%

          Response.redire ct ("Acct_Profilee dit.asp?ACCT_NO ='" & strAcctNo &"'")

          End if


          "Evertjan." <exjxw.hannivoo rt@interxnl.net wrote in message
          news:Xns9B47D75 745A01eejj99@19 4.109.133.242.. .
          Marge wrote on 30 okt 2008 in microsoft.publi c.inetserver.as p.general:
          >
          >"Marge" <mpeg@yahoo.caw rote in message
          >news:ONqwyvrOJ HA.4776@TK2MSFT NGP05.phx.gbl.. .
          >>This may be in the wrong forum, but here goes.
          >>>
          >>How can I display an alert in the users browser window from an asp
          >>page.
          >>>
          >>For example, a welcome message. I know I can do this with
          >>response.writ e, but I'd like to have a general method of displaying
          >>messages to the user.
          >
          [Please do not toppost on usenet]
          >
          >I meant to add this in the post. I've tried using this code, but
          >nothing happens:
          >>
          ><%
          > msg = "Just a Test Message"
          > Response.Write( "<" & "script language=VBScri pt>")
          > Response.Write( "MsgBox """ & msg & """<" & "/script>")
          >%>
          >
          Your clientside vbscript, if it works, then only on IE.
          >
          Try:
          >
          >
          message = "Hello world"
          %>
          <script type='text/javascript'>
          alert('<% = message %>');
          </script>
          <%
          >
          >
          >
          --
          Evertjan.
          The Netherlands.
          (Please change the x'es to dots in my emailaddress)
          >

          Comment

          • Evertjan.

            #6
            Re: Display alert or messages to the user.

            Marge wrote on 30 okt 2008 in microsoft.publi c.inetserver.as p.general:

            [Please Please Please Please Please do not toppost on usenet]

            Thanks Evertjan and Tim. I got no alert nor did I get any error
            message. Here is a code fragment that I am using. Perhaps your keen
            eyes will see where this little fool is messing up:
            >
            If UCase(strStatus ) = "PENDING" Then
            >
            strMSG = "You must complete the following form!"
            >
            %>
            <script type='text/javascript'>
            alert('<% = strMSG %>');
            </script>
            <%
            >
            Response.redire ct ("Acct_Profilee dit.asp?ACCT_NO ='" & strAcctNo &"'")
            [no reason to put single quotes in a querystring]

            If you do a redirect, no clientside code is executed,
            as the redirect command goes to the html header.

            =============== =============== =============== ===
            <%
            If UCase(strStatus ) = "PENDING" Then
            strMSG = "You must complete the following form!"
            redir = "Acct_Profileed it.asp?ACCT_NO= " & strAcctNo
            %>
            <script type='text/javascript'>
            alert('<% = strMSG %>');
            location.href = '<% = redir %>';
            </script>
            <%
            response.end
            End If
            %>
            =============== =============== =============== =====

            Perhaps some learing about the difference of
            serverside vs clientside execution is required?

            --
            Evertjan.
            The Netherlands.
            (Please change the x'es to dots in my emailaddress)

            Comment

            • Marge

              #7
              Re: Display alert or messages to the user.

              Thanks Evertjan. I already tried the response.end.

              Also, I left out the asp tags (<%) to avoid confusion. All the correct tags
              are in place and my existing code works.

              I was simply trying to show where I had placed your suggested code.
              M
              "Evertjan." <exjxw.hannivoo rt@interxnl.net wrote in message
              news:Xns9B47E28 E429B0eejj99@19 4.109.133.242.. .
              Marge wrote on 30 okt 2008 in microsoft.publi c.inetserver.as p.general:
              >
              [Please Please Please Please Please do not toppost on usenet]
              >
              >
              >Thanks Evertjan and Tim. I got no alert nor did I get any error
              >message. Here is a code fragment that I am using. Perhaps your keen
              >eyes will see where this little fool is messing up:
              >>
              >If UCase(strStatus ) = "PENDING" Then
              >>
              >strMSG = "You must complete the following form!"
              >>
              >%>
              ><script type='text/javascript'>
              >alert('<% = strMSG %>');
              ></script>
              ><%
              >>
              >Response.redir ect ("Acct_Profilee dit.asp?ACCT_NO ='" & strAcctNo &"'")
              >
              [no reason to put single quotes in a querystring]
              >
              If you do a redirect, no clientside code is executed,
              as the redirect command goes to the html header.
              >
              =============== =============== =============== ===
              <%
              If UCase(strStatus ) = "PENDING" Then
              strMSG = "You must complete the following form!"
              redir = "Acct_Profileed it.asp?ACCT_NO= " & strAcctNo
              %>
              <script type='text/javascript'>
              alert('<% = strMSG %>');
              location.href = '<% = redir %>';
              </script>
              <%
              response.end
              End If
              %>
              =============== =============== =============== =====
              >
              Perhaps some learing about the difference of
              serverside vs clientside execution is required?
              >
              --
              Evertjan.
              The Netherlands.
              (Please change the x'es to dots in my emailaddress)
              >

              Comment

              • Adrienne Boswell

                #8
                Re: Display alert or messages to the user.

                Gazing into my crystal ball I observed "Marge" <mpeg@yahoo.caw riting
                in news:#vIav0sOJH A.3508@TK2MSFTN GP02.phx.gbl:
                Here is a code fragment that I am using. Perhaps your keen eyes will
                see
                where this little fool is messing up:
                >
                If UCase(strStatus ) = "PENDING" Then
                >
                strMSG = "You must complete the following form!"
                >
                %>
                ><script type='text/javascript'>
                alert('<% = strMSG %>');
                ></script>
                ><%
                >
                Response.redire ct ("Acct_Profilee dit.asp?ACCT_NO ='" & strAcctNo &"'")
                >
                End if
                >
                >
                As others have said, any client side script will not execute with a
                redirect.

                Additionally, I hope that you are keeping the values that have already
                been filled out when the user gets the form again. There is nothing
                worse than filling out a long form, omitting one thing, and the script
                comes back with all the previously filled fields blank. This is one of
                the reasons I prefer to post to the same page.

                --
                Adrienne Boswell at Home
                Arbpen Web Site Design Services

                Please respond to the group so others can share

                Comment

                • Mark Rae [MVP]

                  #9
                  Re: Display alert or messages to the user.

                  "Evertjan." <exjxw.hannivoo rt@interxnl.net wrote in message
                  news:Xns9B47E28 E429B0eejj99@19 4.109.133.242.. .
                  [Please Please Please Please Please do not toppost on usenet]
                  Well said, though you are clearly wasting your time with Marge...


                  --
                  Mark Rae
                  ASP.NET MVP


                  Comment

                  • Evertjan.

                    #10
                    Re: Display alert or messages to the user.

                    Mark Rae [MVP] wrote on 31 okt 2008 in
                    microsoft.publi c.inetserver.as p.general:
                    "Evertjan." <exjxw.hannivoo rt@interxnl.net wrote in message
                    news:Xns9B47E28 E429B0eejj99@19 4.109.133.242.. .
                    >
                    >[Please Please Please Please Please do not toppost on usenet]
                    >
                    Well said, though you are clearly wasting your time with Marge...
                    TNX. ;-}

                    Usuallly after this I cease responding.


                    --
                    Evertjan.
                    The Netherlands.
                    (Please change the x'es to dots in my emailaddress)

                    Comment

                    • Mark Rae [MVP]

                      #11
                      Re: Display alert or messages to the user.

                      "Evertjan." <exjxw.hannivoo rt@interxnl.net wrote in message
                      news:Xns9B4864E 467A58eejj99@19 4.109.133.242.. .
                      >>[Please Please Please Please Please do not toppost on usenet]
                      >>
                      >Well said, though you are clearly wasting your time with Marge...
                      >
                      TNX. ;-}
                      >
                      Usually after this I cease responding.
                      Me too.


                      --
                      Mark Rae
                      ASP.NET MVP


                      Comment

                      • Jeff Dillon

                        #12
                        Re: Display alert or messages to the user.

                        "Evertjan." <exjxw.hannivoo rt@interxnl.net wrote in message
                        news:Xns9B4864E 467A58eejj99@19 4.109.133.242.. .
                        Mark Rae [MVP] wrote on 31 okt 2008 in
                        microsoft.publi c.inetserver.as p.general:
                        >
                        >"Evertjan." <exjxw.hannivoo rt@interxnl.net wrote in message
                        >news:Xns9B47E2 8E429B0eejj99@1 94.109.133.242. ..
                        >>
                        >>[Please Please Please Please Please do not toppost on usenet]
                        >>
                        >Well said, though you are clearly wasting your time with Marge...
                        >
                        TNX. ;-}
                        >
                        Usuallly after this I cease responding.
                        >
                        >
                        --
                        Evertjan.
                        The Netherlands.
                        (Please change the x'es to dots in my emailaddress)
                        Stop being usenet police. Of all the articles I've read on top vs bottom
                        posting, yes, bottom posting is preferred. But it's user choice, and many
                        many people prefer top posting. Personally I've changed from top to bottom,
                        but not because of rude requests like yours. I prefer top.

                        YOU get a decent news reader that supports threaded discussions! Granted,
                        web based readers don't view top postings well. I know all this.

                        Ok, here comes. "this isn't email..blah blah blah". Take a chill pill. But
                        notice I bottom posted.


                        Comment

                        • Evertjan.

                          #13
                          Re: Display alert or messages to the user.

                          Jeff Dillon wrote on 05 nov 2008 in
                          microsoft.publi c.inetserver.as p.general:
                          "Evertjan." <exjxw.hannivoo rt@interxnl.net wrote in message
                          news:Xns9B4864E 467A58eejj99@19 4.109.133.242.. .
                          >Mark Rae [MVP] wrote on 31 okt 2008 in
                          >microsoft.publ ic.inetserver.a sp.general:
                          >>
                          >>"Evertjan." <exjxw.hannivoo rt@interxnl.net wrote in message
                          >>news:Xns9B47E 28E429B0eejj99@ 194.109.133.242 ...
                          >>>
                          >>>[Please Please Please Please Please do not toppost on usenet]
                          >>>
                          >>Well said, though you are clearly wasting your time with Marge...
                          >>
                          >TNX. ;-}
                          >>
                          >Usuallly after this I cease responding.
                          [please do not quote signatures on usenet]
                          >
                          Stop being usenet police. Of all the articles I've read on top vs
                          bottom posting, yes, bottom posting is preferred. But it's user
                          choice, and many many people prefer top posting. Personally I've
                          changed from top to bottom, but not because of rude requests like
                          yours. I prefer top.
                          So I m police if I cease responding? Nonsense!
                          YOU get a decent news reader that supports threaded discussions!
                          Granted, web based readers don't view top postings well. I know all
                          this.
                          No it is logical Netiquesste, because not all news servers aquire
                          postings in a reasonable time, or keep them long enough to support
                          threading.
                          Ok, here comes. "this isn't email..blah blah blah".
                          You seem to be stressed, don't, It is bad for your health, smile Jeff!
                          btw, do you think it is email?
                          Take a chill pill.
                          But notice I bottom posted.
                          Nothing special in that.

                          --
                          Evertjan.
                          The Netherlands.
                          (Please change the x'es to dots in my emailaddress)

                          Comment

                          • Jeff Dillon

                            #14
                            Re: Display alert or messages to the user.

                            Who is stressed? Everyone, feel free to top post. It's personal choice on
                            usenet. Don't be bullied, ignore everdumb! And PLEASE, no personal attacks,
                            this goes for you too, overtlyjammed
                            >>>>[Please Please Please Please Please do not toppost on usenet]

                            Comment

                            • Mark Rae [MVP]

                              #15
                              Re: Display alert or messages to the user.

                              "Jeff Dillon" <jeffdillon@hot mailremove.comw rote in message
                              news:OiREz25PJH A.3936@TK2MSFTN GP06.phx.gbl...
                              >[Please Please Please Please Please do not toppost on usenet]
                              >
                              Who is stressed? Everyone, feel free to top post. It's personal choice on
                              usenet. Don't be bullied, ignore everdumb! And PLEASE, no personal
                              attacks, this goes for you too, overtlyjammed
                              When you read a book, do you begin with the last page and work backwards...?


                              --
                              Mark Rae
                              ASP.NET MVP


                              Comment

                              Working...