Is it possible to change the target of a form with a select box?
Example:
<form action="target1.php" OR "target2.php" method="post">
<select name="league" size="1">
<option value="target1">target1</option>
<option value="target2">target2</option>
</select>
</form>
I know this code doesn't make sences but I hope it illistrates my question.
Change formtarget.php
Moderator: General Moderators
- iknownothing
- Forum Contributor
- Posts: 337
- Joined: Sun Dec 17, 2006 11:53 pm
- Location: Sunshine Coast, Australia
With Javascript:
Untested
Untested
Code: Select all
set_target() {
var target = document.getElementById('selecttarget');
var select_it = document.getElementById('league');
target.form.action = select_it.value;
}
Code: Select all
<form action="" method="post" id="selecttarget" onchange="set_target();">
<select id="league" size="1">
<option value="target1.php">target1</option>
<option value="target2.php">target2</option>
</select>
</form>