Display alert or messages to the user.

M

Marge

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.
 
M

Marge

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=VBScript>")
Response.Write("MsgBox """ & msg & """<" & "/script>")
%>
 
T

Tim Slattery

Marge said:
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=VBScript>")
Response.Write("MsgBox """ & msg & """<" & "/script>")
%

<%msg="Just a Test Message" %>
<script type="text/javascript">
alert("<%=msg%>");
</script>
 
E

Evertjan.

Marge wrote on 30 okt 2008 in microsoft.public.inetserver.asp.general:

[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=VBScript>")
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>
<%
 
M

Marge

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.redirect ("Acct_Profileedit.asp?ACCT_NO='" & strAcctNo &"'")

End if


Evertjan. said:
Marge wrote on 30 okt 2008 in microsoft.public.inetserver.asp.general:

[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=VBScript>")
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>
<%
 
E

Evertjan.

Marge wrote on 30 okt 2008 in microsoft.public.inetserver.asp.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.redirect ("Acct_Profileedit.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_Profileedit.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?
 
M

Marge

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. said:
Marge wrote on 30 okt 2008 in microsoft.public.inetserver.asp.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.redirect ("Acct_Profileedit.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_Profileedit.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?
 
A

Adrienne Boswell

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.redirect ("Acct_Profileedit.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.
 
E

Evertjan.

Mark Rae [MVP] wrote on 31 okt 2008 in
microsoft.public.inetserver.asp.general:
[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.
 
J

Jeff Dillon

Evertjan. said:
Mark Rae [MVP] wrote on 31 okt 2008 in
microsoft.public.inetserver.asp.general:
[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.

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.
 
E

Evertjan.

Jeff Dillon wrote on 05 nov 2008 in
microsoft.public.inetserver.asp.general:
Evertjan. said:
Mark Rae [MVP] wrote on 31 okt 2008 in
microsoft.public.inetserver.asp.general:
[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.
 
J

Jeff Dillon

No, but I don't read every page over again when I go to the next page. I've
already read the previous pages. Hey, it's a personal choice. That is my
point. Let people post the way they feel comfortable. Don't enforce your
choice on other people.

Mark Rae said:
[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...?
 
A

Adrienne Boswell

Gazing into my crystal ball I observed "Jeff Dillon"
<[email protected]> writing in

Yes, I am top posting, but this is because this is a classic example of
why one should not top post. This message does not make any sense with
the last post on top, you see?

Evertjan did not make any person attacks, he merely _requested_ that
Marge not top post.
No, but I don't read every page over again when I go to the next page.
I've already read the previous pages. Hey, it's a personal choice.
That is my point. Let people post the way they feel comfortable. Don't
enforce your choice on other people.

Mark Rae said:
[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...?
 
M

marge

I'm sorry, but I don't know why everyone is yelling at me about Top
Posting??? Now that I'm out of the hospital I started to catch up and
blam...

First, I don't know what that is, second I only post here. So if I have a
setting that is incorrect or something out of place, please let me know.

I certainly do not want to disrespect this NG or any other.

If someone could provide me with more info I would appreciate it.

Evertjan. said:
Marge wrote on 30 okt 2008 in microsoft.public.inetserver.asp.general:

[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=VBScript>")
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>
<%
 
A

Adrienne Boswell

I'm sorry, but I don't know why everyone is yelling at me about Top
Posting???

You might want to look at http://www.idallen.com/topposting.html.
Basically, top posting makes it hard for others to read messages,
because the order has been mixed up.

1. How many should we buy?
2. Seventeen
3. Longs or shorts?

as opposed to

3. Longs or shorts?
1. How many should we buy?
2. Seventeen

Now that I'm out of the hospital I started to catch up and
blam...

Hope you are feeling better.
 
M

marge

Thank you, now I understand. If correct, it means I should reply to the post
that I am directly reading as opposed to the one(s) above?

I will try to make sure I don't do that again!!!

Yes, am much better - lots more to go, but better. Thanks for the kind
comment and the info.

M.
 
M

marge

I've re-read every post here and I have to say, some of you people are
complete and utter jerks.

To think that one would do this "TOP POSTING" on purpose (yes a few have to
make a point), is utter stupidity and in my opinion is a complete waste of
time to natter about. Not to mention waste of bandwidth and disk space. GROW
UP LITTLE KIDS!!!

Get a life and forgive people that make a mistake once in a while!

If you all think you are better than anyone else, then good luck to you and
your miserable life!!! JERKS!!!!

This is supposed to be an NG for help, not RIDICULE!!!

I'm Ok with this, cause it was just a mistake, not a life threatening
issue!!!
 
E

Evertjan.

marge wrote on 09 nov 2008 in microsoft.public.inetserver.asp.general:
I've re-read every post here and I have to say, some of you people are
complete and utter jerks.

With scarce interposting, that would not have been necessary, you
probably would not have lost track of the conversation.
To think that one would do this "TOP POSTING" on purpose (yes a few
have to make a point), is utter stupidity and in my opinion is a
complete waste of time

Whose time is wasted?
Feel free not to read postings in a NG, so no time is "wasted".
feel free not to respond if it wastes your time.
to natter about. Not to mention waste of
bandwidth and disk space. GROW UP LITTLE KIDS!!!

Get a life and forgive people that make a mistake once in a while!

Who is talking about mistakes?
Politely asking for not topposting is NOT pointing to mistakes, but is
simply trying to point to a good usenet habit, following the longtime
experience of usenet called netiquette.

Scarce interposting spares bandwith. Topposting wastes bandwith, as it
usually repeats the whole thread is an unlogivcal way, while scarce
interposting only repeats the parts one is reacting on.
Bottomposting is nearly or just as bad as topposting.
If you all think you are better than anyone else, then good luck to
you and your miserable life!!! JERKS!!!!

Politeness never hurts, or does it?
This is supposed to be an NG for help, not RIDICULE!!!

I don't know why you would suppose the first.
This is a NG for discussing on-topic subjects.
[Classic ASP and NG-netiquette being on-topic]

This NG is NOT a helpdesk.

That people are often helped by discussing
seems a logical consequence of discussions.

On a helpdesk you can specify the range of the answers to a Q[uestion].
In a NG you do not have to post only Qs, and if you post a Q,
you cannot limit the answers or reply postings.
I'm Ok with this, cause it was just a mistake, not a life threatening
issue!!!

What was a mistake? With scarce interposting I would know what part of
the thread you thought to be your or someone elses mistake.

Perhaps you were mistaken?
 
A

Adrienne Boswell

Gazing into my crystal ball I observed "marge" <[email protected]> writing
in
Marge, you're not getting it. You are still top posting, and messages
do not make sense. Read this entire message from top to bottom and you
will see what I am talking about. Top posting means placing your reply
to the post on the _TOP_ of the message. The preferred method is
posting your reply on the _bottom_ of the message, as most people read
from top to bottom, not bottom to top. This is especially true if the
message has many replies on the bottom, and one message on the top. The
whole order of the message gets mucked up. Got it?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top