The strength of the electromagnet depends on the amount of electric current
through the wire coil and the number of turns of wire in the coil.
But the current through the wire depends directly on the voltage of the battery,
so that's also indirectly involved.