Javascript not working?

How come neither of this work, they don’t change the form’s action value.


                            <form method="post" action="testa">
                                <select onchange="this.form.action=this.options[this.selectedIndex].value;">
                                    <option value="testa" selected="selected">Map</option>
                                    <option value="testb">Replay</option>
                                    <option value="testc">Image</option>
                                    <option value="testd">Map</option>
                                </select>
                                <input type="submit" value="Submit" />
                            </form>

Still doesn’t work:


                            <form id="testform" method="post" action="testa">
                                <select name="testinput" onchange="document.getElementById('testform').action=this.options[this.selectedIndex].value;">
                                    <option value="testa" selected="selected">Map</option>
                                    <option value="testb">Replay</option>
                                    <option value="testc">Image</option>
                                    <option value="testd">Map</option>
                                </select>
                                <input type="submit" value="Submit" />
</form>

It’s weird cause if I use… onchange="document.write(this.options[this.selectedIndex].value); it successfully displays the value.