i am making a game by hand and i need a LOT of different functions to be called useing the same button and witch one is called depends on where you are in the script but at all times at least 2 to be called when it is pressed

is there any way i can just change what 1 function dos with a var ? so somthing like

var stuff = if (somthing == 1){do this}

function A(){

if not the other problem i am having is
document.getElementById("button").onclick = dosomthing
only seems to run 1 thing

need help ASAP