Answer the question
In order to leave comments, you need to log in
How to pass value from select to action?
I take the data from the select, but I can't insert it into the action of the form!
<form method="post" id="sys" action="link.php">
<p><select id="selec" name="sys" onchange="change()">
<option value=''>Choose</option>
<option value="1" >1</option>
<option value="2" >2</option>
</select></p>
</form>
var select, value;
function change() {
select = document.getElementById("selec");
value = select.options[select.selectedIndex].value;
document.sys.action = "/AAA";
}
Answer the question
In order to leave comments, you need to log in
<script>
window.onload = function(){
document.all.selec.onchange = function(){
document.all.sys.setAttribute("action",this.value);
}
}
</script>
<form method="post" id="sys" action="link.php">
<p><select id="selec" >
<option value=''>Choose</option>
<option value="1" >1</option>
<option value="2" >2</option>
</select></p>
</form>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question