the only other way I can think of is the way you were doing it originally, but that can have browser compatibility issues as well as possibly other issues as you are finding out.
If it’s only one or two options that vary, using the option-specific scripting to modify them could work well.
If instead there will be different groups of options, it could be better to have all of the available selections on the page and then to only enable the one that counts.