execute javascript conditionally

  • Thread starter Thread starter cgia
  • Start date Start date
C

cgia

How to do the following?

When I click a button, it will check if a certain codition is
satisfied, in this case, and only in this one, I want the javascript
confirm to appear.

If I add this:

mybutton.Attributes.Add("onClick", "return confirm('Your Message');")

the popup will appear ALL the times I press the button.

Thanks
 
Hello (e-mail address removed),
When I click a button, it will check if a certain codition is
satisfied, in this case, and only in this one, I want the javascript
confirm to appear.
mybutton.Attributes.Add("onClick", "return confirm('Your Message');")

mybutton.Attributes.Add("onClick", "if (someClientSideLogicVariable) return confirm('Your Message'); else return true;");
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top