execute javascript conditionally

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
 
M

Matt Berther

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

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top