event capture

Discussion in 'Javascript' started by alcool, Jul 25, 2007.

  1. alcool

    alcool Guest

    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
    alcool, Jul 25, 2007
    #1
    1. Advertising

  2. alcool

    RobG Guest

    On Jul 25, 6:56 pm, alcool <> wrote:
    > 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);
    }


    --
    Rob
    RobG, Jul 25, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mr. x

    capture a tablecell event

    Mr. x, Sep 2, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    1,117
    Mr. x
    Sep 2, 2003
  2. Feng
    Replies:
    1
    Views:
    7,931
  3. marcia

    Capture "Enter" event

    marcia, Aug 18, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    3,376
    Steve C. Orr, MCSD
    Aug 18, 2003
  4. Viny
    Replies:
    1
    Views:
    4,027
    Mike Moore [MSFT]
    Oct 24, 2003
  5. Max
    Replies:
    7
    Views:
    9,070
Loading...

Share This Page