[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Call an Alert box with ASP

Posted on 2005-05-05
7
Medium Priority
?
399 Views
Last Modified: 2010-08-05
I want to call an alert box with asp with out distrubing the page.
I can do it with the code below but I know that there has to be a better way

<%
Response.Write("some code")
%>
<script language = JavaScript>
      alert('Alert');
</script>
<%
Response.Write("some code")
%>

Let me know if you know of a better way than the above code or just doing a Response.Write("Alert").
0
Comment
Question by:quest_capital
7 Comments
 

Author Comment

by:quest_capital
ID: 13936893
The code above turns the page white when it gets to the alert box.
0
 
LVL 10

Expert Comment

by:ThaSmartUno
ID: 13937001
what do you mean by not disturbing tha page?
0
 
LVL 11

Expert Comment

by:raj3060
ID: 13937028
>>The code above turns the page white when it gets to the alert box.

Reason is that you need to run this on server..

try this:

<%
Response.Write("some code")
%>
<p>I am here.....</p>
<script language = JavaScript>
     alert('Alert');
</script>
<%
Response.Write("some code")
%>
<p>and I am here too.....</p>
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 23

Expert Comment

by:apresto
ID: 13937771
You can use a vbscript pop up when the page loads:

<Script language="vbscript">
msgbox "Alert"
</Script>
0
 
LVL 13

Accepted Solution

by:
davidlars99 earned 1000 total points
ID: 13938314
try this

<script language=Javascript>
   setTimeout('alert("Done")', 555)
</script>


or this (IE only)

<script language=Javascript>
   function check(){
       if(document.body.readyState=="complete")
              setTimeout('alert("complete")',555);
       else
              setTimeout('check()', 100);
   }

   check();
</script>
0
 
LVL 13

Expert Comment

by:davidlars99
ID: 13938349
or mix them up

<script language=Javascript>

   var ie=(navigator.userAgent.toLowerCase().indexOf("msie")!=-1?true:false);

   function check(){
       if(ie)
            if(document.body.readyState=="complete")
                 setTimeout('alert("complete")', 555);
            else
                 setTimeout('check()', 25);
        else
            setTimeout('alert("complete")', 600);
   }

   check();
</script>
0
 
LVL 14

Expert Comment

by:kiddanger
ID: 13942635
You cannot have an alert in the middle of an ASP script and have it execute immediately.  All ASP scripting is evaluated and processed before the client gets the code and then the client renders the results.  At that point the alert, would execute, if not in a function, as the page loads.
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

829 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