Solved

Message Box

Posted on 1998-07-16
7
230 Views
Last Modified: 2010-04-09
Hi Experts,

   May I know how can I show a messsage box using ASP in a .asp file ?
   Hope it is not too difficult
0
Comment
Question by:seahpc
  • 4
  • 3
7 Comments
 
LVL 28

Expert Comment

by:sybe
ID: 1844674
What do you mean with a "message box", something like can be done with javascript ?
0
 
LVL 2

Author Comment

by:seahpc
ID: 1844675
Javascript or VBScript will do .
cos I don't want to navigate to another page to show the error message .
If I do this, then When I navigate back, all my textfield will be empty and I need
to type in all over again just for a mistake I made earlier .

0
 
LVL 28

Expert Comment

by:sybe
ID: 1844676
in javascript:

<script>
alert("this is a message")
</script>

Is this what you mean ?
0
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
LVL 2

Author Comment

by:seahpc
ID: 1844677
Yes,

But How am I going to call it in the ASP Script ?
Let say

if index < 1 then
   ' Need to call the message box here
end if

<Script Language = "JavaScript">
alert("dffdg")
</Script>
0
 
LVL 28

Accepted Solution

by:
sybe earned 40 total points
ID: 1844678
1.
<% If index < 1 Then %>
   <script>
     alert("this is a message")
    </script>
<%End If%>

2.
<%
If Index < 1 Then
  Response.write "<script>alert('this is a message'):</script>"
End If
%>




%>



0
 
LVL 2

Author Comment

by:seahpc
ID: 1844679
er............ For your information,
my asp script is run at server. So if I use your codes,
it gives an error message nested Script .

Any other idea ?
0
 
LVL 28

Expert Comment

by:sybe
ID: 1844680
Ah, I see, you use:

<SCRIPT RUNAT=SERVER>

</SCRIPT>

as your ASP scripting tags. Yep, then that is what happens.

Change those tags to:
<% and %>
And the problem is gone.

or do it like this:


.
..
If index < 1 Then
</SCRIPT>

<script>
 alert("this is a message")
</script>

<SCRIPT RUNAT=SERVER>
End If
..
.


You have to write the javascript code outside of the <SCRIPT RUNAT=SERVER> tags.
With <% %> you can write javascript code


0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question