OnClick event

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • f1crazed@gmail.com

    OnClick event

    Hello,

    I am wanting to fire the onClick event of button1 by pressing button2.
    Does anyone have a clue if this is even posible? If so PLEASE HELP!!
    Thanks.

  • Dietmar Meier

    #2
    Re: OnClick event

    f1crazed@gmail. com wrote:
    [color=blue]
    > I am wanting to fire the onClick event of button1 by pressing
    > button2. Does anyone have a clue if this is even posible?[/color]

    Here is a test document. Watch the differing behaviour of MSIE
    compared to other Browsers (Mozilla, Opera, Netscape 4) when
    clicking the second button:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN Transitional"
    "http://www.w3.org/TR/html4/transitional.dt d">
    <html>
    <head>
    <meta http-equiv="Content-Script-Type" content="text/javascript">
    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
    <title>Some Events</title>
    <script type="text/javascript">
    window.name = "myWindow";
    </script>
    </head>
    <body>
    <form action="" name="myForm">< p>
    <input type="button" value="1" name="myButton1 "
    onclick="alert( this.name + '\n' + (event &amp;&amp; event.type))"[color=blue]
    >[/color]
    <input type="button" value="2" name="myButton2 "
    onclick="var o = form.elements['myButton1'], h = o.onclick;
    if (typeof h == 'function') h()"[color=blue]
    >[/color]
    <input type="button" value="3" name="myButton3 "
    onclick="var o = form.elements['myButton1'], h = o.onclick;
    if (h && h.apply) h.apply(o, [event])"[color=blue]
    >[/color]
    <input type="button" value="4" name="myButton4 "
    onclick="var o = form.elements['myButton1'], h = o.onclick;
    if (h && h.apply) h.apply(this, [event])"[color=blue]
    >[/color]
    </p></form>
    </body>
    </html>

    ciao, dhgm

    Comment

    • Lee

      #3
      Re: OnClick event

      f1crazed@gmail. com said:[color=blue]
      >
      >Hello,
      >
      >I am wanting to fire the onClick event of button1 by pressing button2.
      >Does anyone have a clue if this is even posible? If so PLEASE HELP!!
      >Thanks.
      >[/color]

      <button onclick="doSome thing()">button 1</button>
      <button onclick="doSome thing()">button 2</button>

      How is what you want different from this?

      Comment

      • f1crazed@gmail.com

        #4
        Re: OnClick event

        Dietmar,
        Thankyou!!!! This is what I was wanting to do. Thanks so much!!!!

        JD

        Comment

        Working...