Solved

Message Box

Posted on 1998-07-16
7
223 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
Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Bad <form> statement? 9 31
how to avoid redundand ajax calls 5 30
Input box width 6 27
HTML &#0153 2 19
Showing your events from Google Calendar in Google Maps Why? I travel all week and I thought it would be ideal if staff in office knew where I was based on my calendar. (OK real reason: my son wanted to see where I would be working, and I thoug…
This article discusses how to create an extensible mechanism for linked drop downs.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

809 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