473,386 Members | 1,799 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,386 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 798
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: ...
8
by: GiJeet | last post by:
hello, is it possible to determine the browser and version using javascript at runtime and apply a browser specific external .css file? If so, I'd appreciate code sample so I can see how it's...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.