By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,551 Members | 2,741 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,551 IT Pros & Developers. It's quick & easy.

how to know which of the 2 buttons are clicked

P: 14
hi there,

how will i know which of the 2 buttons are clicked. i tried using
var flag = document.frmMain.btnSave.Clicked;
and printing the value of flag to know. but it turns out to be null.

can anyone help me out here please..
Feb 1 '08 #1
Share this Question
Share on Google+
6 Replies


rpnew
100+
P: 188
hi there,

how will i know which of the 2 buttons are clicked. i tried using
var flag = document.frmMain.btnSave.Clicked;
and printing the value of flag to know. but it turns out to be null.

can anyone help me out here please..
Hi,
well what do you exactly want to do? i mean as what i understood you have two buttons and you want to kwow which of them is clicked..rigtht? well you can do the following then... call one function by passing some value... and through value you'll know which button is clicked......... or post your code here so we can have a look at it...... and give you some ideas.......

Regards,
RP
Feb 1 '08 #2

P: 14
hey thanks for the response so soon.
actually there are 2 buttons save and save n close.
right now both of them behaves the same way as how save is clicked.
so i want to know which button is clicked so that i can make it act like that.
hope this gives u an idea
Feb 1 '08 #3

rpnew
100+
P: 188
hey thanks for the response so soon.
actually there are 2 buttons save and save n close.
right now both of them behaves the same way as how save is clicked.
so i want to know which button is clicked so that i can make it act like that.
hope this gives u an idea
hi,
well if you want to do different things on clicking different buttons then simply define two different function and call them on onclick event of these buttons...........
However what are you using as your frontend?... post your code where you are creating these buttons.........

Regards,
RP
Feb 1 '08 #4

P: 14
front end is the XSL that we are using. what should the functions take in as argument. can u write an e.g function
Feb 1 '08 #5

rpnew
100+
P: 188
front end is the XSL that we are using. what should the functions take in as argument. can u write an e.g function
Hi,
i meant something like this.......

[HTML]
<input type=button value="save" onclick="javascript: functionone()">
<input type=button value="save n cancel" onclick="javascript: functiontwo()">
[/HTML]

Expand|Select|Wrap|Line Numbers
  1. function functionone()
  2. {
  3.    //code goes here
  4. }
  5. function functiontwo()
  6. {
  7.    //code goes here
  8. }
  9.  
Feb 1 '08 #6

gits
Expert Mod 5K+
P: 5,333
just to mention that you should correct the html, put the attribute values in quotes and the javascript: is really obsolete too ... the function call is always enough:

[HTML]<input type="button" value="save" onclick="functionone();">[/HTML]
kind regards
Feb 1 '08 #7

Post your reply

Sign in to post your reply or Sign up for a free account.