ssffcc Posted March 20, 2006 Share Posted March 20, 2006 please help on this:when user clicks on "cancel" button, I want to popup a window asking "are you sure to cancel", if user clicks "yes", the code for "cancel" will execute, otherwise do nothing Link to comment Share on other sites More sharing options...
scott100 Posted March 20, 2006 Share Posted March 20, 2006 Have you gone through the tutorials yet? this should be a straightforward task <html><head><script type="text/javascript">function disp_confirm(){var name=confirm("Press a button") if (name==false) { var choice=confirm("Are you sure you want to cancel?") if (choice==true) { alert("put cancel code here"); } else{} } else { }}</script></head><body><form><input type="button" onclick="disp_confirm()" value="Confirm"></form></body></html> Link to comment Share on other sites More sharing options...
ssffcc Posted March 21, 2006 Author Share Posted March 21, 2006 I dont quite understand "if (name==false)". what is it for? Link to comment Share on other sites More sharing options...
scott100 Posted March 21, 2006 Share Posted March 21, 2006 I dont quite understand "if (name==false)". what is it for?<{POST_SNAPBACK}> for a confirm box: if you press ok it returns true, if you press cancel it returns falsewhat is name? Its the result of the confirm button, either true or falsename=confirm("Press a button")You then check its value in a control structure Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now