javascript change name of called function -


hi im new javascript please gentle. im mixing php calls , have slight issue. need alter function name called in onclick event.

<div class=\"span4\" id=\"pass\">     <button class=\"btn btn-block btn-large btn-warning\" id=\"bypass\" disabled onclick=\"pass(); return false;\">         -      </button> </div> 

above div std call. before point variables set function call , need change above call "pinpass2() or pinpass3 etc.

function pincheck(id,type,lastid,pin){     document.getelementbyid('fade').style.display=\"block\";     document.getelementbyid('calc').style.display=\"block\";       var staffid = id;     document.getelementbyid('bypass').onclick = function (){\"pinpass\"+staffid();      return false; }; } 

the above function should can't seem working. appreciated. p.s if include following pincheck function desired staffid diaplayed

alert(\"staff id\"+staffid); 

you can change onclick attribute same way you'd change attribute ?

var elem = document.getelementbyid('bypass');  elem.setattribute('onclick', 'pinpass' + staffid + '(); return false;'); 

fiddle


Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -