Connecting Tech Pros Worldwide Help | Site Map

Clientside ONCLICK excute both click cmd one after the other

Familiar Sight
 
Join Date: Sep 2006
Posts: 142
#1: Oct 13 '09
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.click()"
Expand|Select|Wrap|Line Numbers
  1. fcLabel = "<INPUT type=button value='Process Data' onclick=Done.click(); ___Submit.click() language='javascript'>"
  2.  
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's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,642
#2: Oct 13 '09

re: Clientside ONCLICK excute both click cmd one after the other


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:
Expand|Select|Wrap|Line Numbers
  1. // W3C
  2. input_elem.addEventListener("click", function(evt) { Done.click(); ___Submit.click(); }, false);
  3. // cross-browser
  4. addEvent(input_elem, "click", function(evt) { Done.click(); ___Submit.click(); }, false);
Familiar Sight
 
Join Date: Sep 2006
Posts: 142
#3: Oct 13 '09

re: Clientside ONCLICK excute both click cmd one after the other


Thank You very much :)

Expand|Select|Wrap|Line Numbers
  1. fcLabel = "<INPUT type=button value='Process Data' onclick='Done.click(); ___Submit.click();' language='javascript'>" 
  2.  
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,642
#4: Oct 13 '09

re: Clientside ONCLICK excute both click cmd one after the other


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