Javascript confirm box with yes or no button -


i have save record depend on user response either yes or no , in java script need confirm box yes , no button. if press save button records should save, other wise focus on particular control textbox.

   <button onclick="myfunction()">try it</button>         <p id="demo"></p>        <script type="text/javascript">           function myfunction(){              var x;              var r=confirm("press button!");              if (r==true){                  x="you pressed ok!";              }              else{                  x="you pressed cancel!";              }              document.getelementbyid("demo").innerhtml=x;          }       </script> 

instead of yes or no can use default values ok or cancel.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -