473,396 Members | 1,693 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

execute javascript conditionally

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
Nov 18 '05 #1
1 985
Hello cg*****@katamail.com,
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;");

--
Matt Berther
http://www.mattberther.com
Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: dbb9h | last post by:
I've noticed a problem with calls to server.execute on a webserver running IIS 5.0. The call is used to conditionally include some asp code according to the language, but there seem to exist...
4
by: finlma | last post by:
I'm trying to run an EXECUTE IMMEDIATE within a PL/SQL if loop but it doesn't work for me. I'm trying to create a column conditionally but it doesn't work. It fails because there are apostrophes...
5
by: jw56578 | last post by:
How would you go about dynamically executing a stored proc dependent on a variable? I cannot use dynamic sql.
4
by: cotton_gear | last post by:
Hello, I need to add some javascript code block dynamically to a web page. I looked into the various postings at various groups but none seems to be solving my problem. Among the approaches...
1
by: cgia | last post by:
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: ...
7
by: Tom | last post by:
How can I make code not execute for a debug build, but do execute for a production build? I have code which prompts for an account and password when the program starts up. It is a pain to have to...
6
by: Teddy.Gammell | last post by:
Hi, I would like to write a function which does this: for each element in the list call f1() of each element. if f1() return false, break the loop else continue I try to use the...
6
by: simon | last post by:
hello, what code would i use to kick off a javascript script after i had registered it? If (Not Page.IsClientScriptBlockRegistered("jsScript")) Then Page.RegisterClientScriptBlock("jsScript",...
3
by: Wayne Sepega | last post by:
I have inherited from System.Web.UI.WebControls and overrode the OnRender of my new button. In the on render I generate some JavaScript and add it as an attribute as follows: ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.