hOn 21 September 2010 15:29, Chris <[email protected]> wrote:
> I tried it already and it just stops the whole thing from working.
> From what I can gather, the details from the radio buttons are not
> being sent to the other file, gmap.js
That's right. You need to alter the function "showPolyline" in
gmap.js, which is where the calculation is done. But it's not a maps
issue; it's getting Javascript to recognise a value of an input element.
I would suggest this line
var cost=miles*10;
which is a fixed multiplier, should be something like
var cost=miles*unitcost;
and then you have an event handler on the radio buttons to set
unitcost to the value you need for each option. Set a default value
first just in case the button is pressed without setting an option.
<script>
var unitcost = 10; // global
function setcost(el) {
if (el.value == "small" ) { unitcost = 10 }
else if (el.value == "medium") { unitcost = 100 }
else if (el.value == "large") { unitcost = 1000 }
// or whatever values you need
}
</script>
<input type="radio" id="vehicle" value="large" name="vehicle"
onchange="setcost(this)">
--
You received this message because you are subscribed to the Google Groups
"Google Maps API V2" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-api?hl=en.