quest_capital
asked on
Call an Alert box with ASP
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").
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").
what do you mean by not disturbing tha page?
>>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>
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>
You can use a vbscript pop up when the page loads:
<Script language="vbscript">
msgbox "Alert"
</Script>
<Script language="vbscript">
msgbox "Alert"
</Script>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
or mix them up
<script language=Javascript>
var ie=(navigator.userAgent.to LowerCase( ).indexOf( "msie")!=- 1?true:fal se);
function check(){
if(ie)
if(document.body.readyStat e=="comple te")
setTimeout('alert("complet e")', 555);
else
setTimeout('check()', 25);
else
setTimeout('alert("complet e")', 600);
}
check();
</script>
<script language=Javascript>
var ie=(navigator.userAgent.to
function check(){
if(ie)
if(document.body.readyStat
setTimeout('alert("complet
else
setTimeout('check()', 25);
else
setTimeout('alert("complet
}
check();
</script>
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.
ASKER