<form action="http://maps.google.it/maps" method="get">
<input type="text" name="saddr">
<input type="hidden" name="daddr" value="My Address">
<input type="hidden" name="dirflg" value="r">
<input type="submit" value="Go">
</form>That will require JS to do, and offhand I'm not sure how best to do that.
function calcRoute() {
var start = document.getElementById('start').value;
}
<select id="start" onchange="calcRoute();">
<option value="Piazza dei cinquecento, Roma">Termini</option>
<option value="Via Fausto Gullo 58, Roma">Giacomo</option>
<option value="Via Daniele Manin 72, Roma">Manin</option>
</select> <form style="display:inline">
<input type="text" id="start" placeholder="Start address">
<input type="submit" value="Go" onsubmit="calcRoute();">
</form>
Call getElementById() on the select, get its value, then call getElementById() on the textbox and set its value to that of the dropdown.
function calcRoute( input ) {
var start = document.getElementById('start').value;
}<input type="text" id="start">
<input type="submit" value="Go"> <form>
<input type="text" id="start" name="start">
<input type="button" onclick="calcRoute();" value="Go">
</form>function calcRoute() {
var start = document.getElementById('start').value;
}Of course it would. Except the 'input' variable that you're 'passing' to calcRoute would just be undefined. Since you're not passing anything to it from the onclick, there's no need to declare that it accepts a parameter ;)Code: [Select] function calcRoute() {
var start = document.getElementById('start').value;
}
Define 'didn't work'
At the end of the onsubmit event, return false. You don't want the page to be reloaded, so that's the way to do that.
The only reason it didn't get reloaded before is because you're not using input type="submit" which would do that.