How to submit form with selected value when i use onchange?
And how set Action to get values?
I have This
<script>
function getAction() {
formAction = document.myForm.myMenu.value;
document.myForm.action = formAction;
document.myForm.submit();
}
</script>
<form name="myForm" method="get" onsubmit="getAction();" action="">
<input type="text" name="q" size="70" maxlength="100" id="input" />
<select name=myMenu id="menu" onchange="submit();" >
<option value="https://www.google.com/search?q=" > Google</option>
<option value="http://www.bing.com/search?q=" >Bing</option>
<option value="https://next.duckduckgo.com/?q=" > DuckDuckGo</option>
<input type="submit" name="go" value="Search" id="button" >
</form>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…