Thursday, June 6, 2024
Homepage · c#
 Popular · Latest · Hot · Upcoming
184
rated 0 times [  187] [ 3]  / answers: 1 / hits: 24273  / 13 Years ago, thu, may 5, 2011, 12:00:00

How can i get the value that was pressed in the confirm box?



 <script type = text/javascript language = javascript>
function confirm_proceed()
{
if (confirm(Are you sure you want to proceed?)==true)
return true;
else
return false;
}
</script>


C#



  Button2.Attributes.Add(onclick, return confirm_proceed(););

More From » c#

 Answers
10

Try this, if this is the only button that has this behavior



Button2.Attributes.Add(onclick, return confirm('Are you sure you want to proceed?'));


it's inline and looks straightforward but if you have multiple controls that behave this way then your original approach would be easy to maintain.



And your original function could be shrunken to



 <script type = text/javascript language = javascript>
function confirm_proceed()
{
return confirm(Are you sure you want to proceed?);
}
</script>

[#92400] Tuesday, May 3, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
catrinas

Total Points: 587
Total Questions: 100
Total Answers: 105

Location: Rwanda
Member since Thu, Feb 10, 2022
2 Years ago
;