You'll need the script which is here

You'll see from the form, if product one is selected then only the variations for that product are shown, the same for product two etc.

In the dropdown.js file, scroll to the bottom and change the: dynamicSelect("product", "colour"); to whatever your select id="name of your product" and select id="color or variation" is.

Product One: Quantity: