Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

An ASP dialog box?

Status
Not open for further replies.

DeepBlerg

Technical User
Jan 13, 2001
224
AU
Is there an ASP function similar to the javascript "return confirm" that opens a confirm box?
 
There is not a specific ASP (server side) function to do this because a confirm box is a client side object.

Just trying to clarify a bit and bolster wushutwist's reply.
penny.gif
penny.gif
 
I insert this javascript into my ASP page and it doesn't do anything....

<SCRIPT LANGUAGE=&quot;JavaScript&quot; TYPE=&quot;text/javascript&quot;>
<!--
return confirm('Record added successfully\n\n ' + 'Returning you to Home page\n');
//-->
</SCRIPT>

Could it be because of the: <%@ LANGUAGE = VBScript%> at the top?
 
Your syntax is not correct, you should be writing a function instead of just putting code someplace. What are you returning from? You to remove the return from your javascript to work the way you have it written. It still won't redirect unless you write javascript to do that also. Wushutwist
 
deepblerg,

Here's how you can use confirm() in a function.
Code:
function confirmIt(){
  if (confirm('Go to the next page?'))
    //user pressed OK -- do something
    location = 'somePage.asp';
  else
    //user pressed CANCEL -- put a return here
    return;
}
And then you can call it in your HTML like this:
Code:
<input type=button value=&quot;Go to next page&quot; onClick=&quot;confirmIt();&quot;>



penny.gif
penny.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top