Link to home
Start Free TrialLog in
Avatar of erin027
erin027Flag for United States of America

asked on

How do I use "Cancel and Ok" function in Javascript?

Hello.
I want to add cancel button on javascript alert message.
How do I do that?

This is my coding so far:

Function button {
alert ("Are you sure?");
}

Thank you
SOLUTION
Avatar of Jai S
Jai S
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Pratima
Pratima
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
i dont understand why the same answers are being given again and again...its just waste of time...
@jaiganeshsrinivasan Actually, your comment did not actually DO anything with the confirm. and if you notice the times, they are given within 10 minutes...
My apologies, I didn't see pratima_mcs's answer but jaiganeshsrinivasan, your answer doesn't seem to explain very clearly which is why I posted a clearer example.
its just a guidance to the author to point to the function...and not posting the same messages again and again...its obvious
Obvious to you but likely not to the poster
Please give the points to the concerned persons.....
Avatar of erin027

ASKER

Thank you guys.
I have one more question though.
How do I post send the info when user click 'Ok'?

<script language="javascript" type="text/javascript">
function button() {
      if (confirm ("Delete?")){
action="category_delete.asp?CategoryID=<%=rs("CategoryID")%>&CategoryImage=<%=rs("CategoryImage")%>";
            return;
            }
      else {
             return false;
            }
}
</script>
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial