473,394 Members | 2,168 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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.
Oct 30 '08 #1
23 7118
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>")
%>
"Marge" <mp**@yahoo.cawrote in message
news:ON**************@TK2MSFTNGP05.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.


Oct 30 '08 #2
"Marge" <mp**@yahoo.cawrote:
>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>

--
Tim Slattery
MS MVP(Shell/User)
Sl********@bls.gov
http://members.cox.net/slatteryt
Oct 30 '08 #3
Marge wrote on 30 okt 2008 in microsoft.public.inetserver.asp.general:
"Marge" <mp**@yahoo.cawrote in message
news:ON**************@TK2MSFTNGP05.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=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>
<%

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Oct 30 '08 #4
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." <ex**************@interxnl.netwrote in message
news:Xn********************@194.109.133.242...
Marge wrote on 30 okt 2008 in microsoft.public.inetserver.asp.general:
>"Marge" <mp**@yahoo.cawrote in message
news:ON**************@TK2MSFTNGP05.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=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>
<%

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

Oct 30 '08 #5
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?

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Oct 30 '08 #6
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." <ex**************@interxnl.netwrote in message
news:Xn********************@194.109.133.242...
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?

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

Oct 30 '08 #7
Gazing into my crystal ball I observed "Marge" <mp**@yahoo.cawriting
in news:#v**************@TK2MSFTNGP02.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.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.

--
Adrienne Boswell at Home
Arbpen Web Site Design Services
http://www.cavalcade-of-coding.info
Please respond to the group so others can share

Oct 30 '08 #8
"Evertjan." <ex**************@interxnl.netwrote in message
news:Xn********************@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...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Oct 31 '08 #9
Mark Rae [MVP] wrote on 31 okt 2008 in
microsoft.public.inetserver.asp.general:
"Evertjan." <ex**************@interxnl.netwrote in message
news:Xn********************@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.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Oct 31 '08 #10
"Evertjan." <ex**************@interxnl.netwrote in message
news:Xn********************@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. ;-}

Usually after this I cease responding.
Me too.
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Nov 1 '08 #11
"Evertjan." <ex**************@interxnl.netwrote in message
news:Xn********************@194.109.133.242...
Mark Rae [MVP] wrote on 31 okt 2008 in
microsoft.public.inetserver.asp.general:
>"Evertjan." <ex**************@interxnl.netwrote in message
news:Xn********************@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.
--
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.
Nov 5 '08 #12
Jeff Dillon wrote on 05 nov 2008 in
microsoft.public.inetserver.asp.general:
"Evertjan." <ex**************@interxnl.netwrote in message
news:Xn********************@194.109.133.242...
>Mark Rae [MVP] wrote on 31 okt 2008 in
microsoft.public.inetserver.asp.general:
>>"Evertjan." <ex**************@interxnl.netwrote in message
news:Xn********************@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)
Nov 5 '08 #13
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]

Nov 5 '08 #14
"Jeff Dillon" <je********@hotmailremove.comwrote in message
news:Oi**************@TK2MSFTNGP06.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
http://www.markrae.net

Nov 6 '08 #15
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 [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
"Jeff Dillon" <je********@hotmailremove.comwrote in message
news:Oi**************@TK2MSFTNGP06.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
http://www.markrae.net

Nov 6 '08 #16
"Jeff Dillon" <je********@hotmailremove.comwrote in message
news:Ov**************@TK2MSFTNGP02.phx.gbl...
>When you read a book, do you begin with the last page and work
backwards...?

No, but I don't read every page over again when I go to the next page.
I've already read the previous pages.
Oh for heaven's sake! What if you add a new newsgroup to your newsreader and
open a thread where only the very last post is still available because all
the others have elapsed? You have to start at the bottom and read
backwards...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Nov 6 '08 #17
Gazing into my crystal ball I observed "Jeff Dillon"
<je********@hotmailremove.comwriting in
news:Ov**************@TK2MSFTNGP02.phx.gbl:

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 [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
>"Jeff Dillon" <je********@hotmailremove.comwrote in message
news:Oi**************@TK2MSFTNGP06.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
http://www.markrae.net




--
Adrienne Boswell at Home
Arbpen Web Site Design Services
http://www.cavalcade-of-coding.info
Please respond to the group so others can share

Nov 6 '08 #18
"Adrienne Boswell" <ar****@yahoo.comwrote in message
news:Xn***************************@69.16.185.250.. .
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?
Absolutely correct.

After many years of this sort of thing, I'd say that about 40% of people who
top-post do it out of sheer laziness or inability to configure their
newsreader properly, 40% do so out of total ignorance of netiquette, and the
remaining 20% do so because it makes them feel "hard", like a bit of a rebel
or like kids who deliberately drop litter or walk on the grass...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Nov 6 '08 #19
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." <ex**************@interxnl.netwrote in message
news:Xn********************@194.109.133.242...
Marge wrote on 30 okt 2008 in microsoft.public.inetserver.asp.general:
>"Marge" <mp**@yahoo.cawrote in message
news:ON**************@TK2MSFTNGP05.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=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>
<%

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

Nov 8 '08 #20
you're fine...

ignore those folks....

Nov 9 '08 #21
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?
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Nov 9 '08 #22
Has this EVER happened to you?

I prefer top posting, thank you. Your mileage may vary.

"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:eF****************@TK2MSFTNGP04.phx.gbl...
"Jeff Dillon" <je********@hotmailremove.comwrote in message
news:Ov**************@TK2MSFTNGP02.phx.gbl...
>>When you read a book, do you begin with the last page and work
backwards...?

No, but I don't read every page over again when I go to the next page.
I've already read the previous pages.

Oh for heaven's sake! What if you add a new newsgroup to your newsreader
and open a thread where only the very last post is still available because
all the others have elapsed? You have to start at the bottom and read
backwards...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Nov 14 '08 #23
Yes, it does make sense. Since I read the thread already, and I don't have
to scroll to see the rest of the message. Thank you for top posting.

I top post for the reasons I have stated.

"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:Om*************@TK2MSFTNGP05.phx.gbl...
"Adrienne Boswell" <ar****@yahoo.comwrote in message
news:Xn***************************@69.16.185.250.. .
>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?

Absolutely correct.

After many years of this sort of thing, I'd say that about 40% of people
who top-post do it out of sheer laziness or inability to configure their
newsreader properly, 40% do so out of total ignorance of netiquette, and
the remaining 20% do so because it makes them feel "hard", like a bit of a
rebel or like kids who deliberately drop litter or walk on the grass...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Nov 14 '08 #24

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Justin Koivisto | last post by:
Is there a way to create an alert-like message box that uses a custom image? Basically, I want to replace the default ! image with something else. -- Justin Koivisto - spam@koivi.com PHP...
8
by: Dan Williams | last post by:
We have an employee table that contains bank details and are experiencing problems with account numbers being erased and lost. In order to track down why this is happening (either due to our...
10
by: DettCom | last post by:
Hello, I would like to be able to display or hide fields based on whether a specific Yes/No radio button is selected. This is in conjunction with a posting a just made here in the same group...
11
by: Alistair Saldanha | last post by:
I'm looking for the event that is fired by Internet Explorer to an "alert": <SCRIPT> Alert("You already have a session open") </SCRIPT> The event would be webBrowser.Document.???? Much...
7
by: Stefan Finzel | last post by:
Hi, is there a way to change the display property on Windows Mobile 2003 SE Mobile/Pocket Internet Explorer? See following example. Please note: visibilty property has the same problem. Is...
3
by: Paul Wilson | last post by:
Hi guys, Can someone tell me how i could display a messagebox in ASP.NEt. Following is what i want to do. Validate the user details, & if the user doesn't have requried access rights, then...
3
by: Wayne Deleersnyder | last post by:
Hi All, I'm trying to create a function that will cause a pop-up alert to appear if dates which were chosen from a drop-down list were invalid on a page. There's 4 dates, so there's the...
1
by: sivaprasadch | last post by:
please can any one suggest me to how to display the alert message text in the different languages. iam implementing localization and globalization concept in my application ,when i change the...
1
by: azgaranoop | last post by:
Hi, i want to display a alert box when a user leave my site.... Means if a user clck on X button i.e on top right corner of the browser or the user click on the address bar and try to change the...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.