event capture

A

alcool

hi,
I need to understand which button (between more) i have pressed

I try to explain myself better ...

I have 2 push-buttons
<input type= " button " id= " Btn1 " value= "... "onclick= " funct();
">
<input type= " button" id= " Btn2" value="..." onclick= " funct (); ">

and

function funct () {
if (//here I must understand what it has been pressed)
document.getElementById ("Box1") .value = "you have pressed 1";
else
document.getElementById ("Box2") .value = "you have pressed 2";
}

how I make?
please help
 
R

RobG

hi,
I need to understand which button (between more) i have pressed

I try to explain myself better ...

I have 2 push-buttons
<input type= " button " id= " Btn1 " value= "... "onclick= " funct();
">
<input type= " button" id= " Btn2" value="..." onclick= " funct (); ">

and

function funct () {
if (//here I must understand what it has been pressed)
document.getElementById ("Box1") .value = "you have pressed 1";
else
document.getElementById ("Box2") .value = "you have pressed 2";

}

how I make?
please help

<input id="btn1" onclick="funct(this)" ... >
<input id="btn2" onclick="funct(this)" ... >

function funct(el) {
alert('You clicked ' + el.id);
}
 

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,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top