Clientside ONCLICK execute both click cmd one after the other

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ismailc
    New Member
    • Sep 2006
    • 200

    Clientside ONCLICK execute both click cmd one after the other

    Good day, I need help Please

    I'm coding within a VBScript window and executing a javscript clientside.

    The problem i have the below code ONCLICK executes the first click "Done.click ()" only and not the second click "___Submit.clic k()"
    Code:
    fcLabel = "<INPUT type=button value='Process Data' onclick=Done.click(); ___Submit.click() language='javascript'>"
    It works when i only have one click within the ONCLICK but not two.

    I tried ";" "," " " behind the first click "Done.click ()"

    Please Assist on getting to click both one after the other!

    Regards
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    if you don’t quote the attribute value, it is by default terminated at the first whitespace (i.e. after the first function).

    you should ALWAYS quote HTML attribute values.

    a way more clean method is using event handlers:
    Code:
    // W3C
    [I]input_elem[/I].addEventListener("click", function(evt) { Done.click(); ___Submit.click(); }, false);
    // cross-browser
    addEvent([I]input_elem[/I], "click", function(evt) { Done.click(); ___Submit.click(); }, false);

    Comment

    • ismailc
      New Member
      • Sep 2006
      • 200

      #3
      Thank You very much :)

      Code:
      fcLabel = "<INPUT type=button value='Process Data' onclick='Done.click(); ___Submit.click();' language='javascript'>"

      Comment

      • Dormilich
        Recognized Expert Expert
        • Aug 2008
        • 8694

        #4
        PS. language is not an attribute of <input> (you can use lang, but that’s related to spoken languages (English, French, etc.))

        Comment

        Working...