you have a couple of problems
- your script is in the head (which is a bad idea anyway) and gets
rendered before the body, so your script runs before the page has a
chance to render your input box, which is why you get "afstand is
undefined" - because it does not exist at the time you are trying to
populate it.
move your script into the body section, with your html elements above
it. that should solve it.
- your polyline is undefined because of a scope issue. try putting the
update() call at the end of your initialize function, instead of
outside of it. and yes, as MymsMan says TilburgUni_TilburgReeshof_path
should not have quotes.
you can compute multiple paths. it would make more sense to me to pass
the name of the path as an argument like
update(TilburgUni_TilburgReeshof_path)
update(TilburgReeshof_GilzeRijen_path)
then
function update(path) {
var afstand = google.maps.geometry.spherical.computeLength(path);
document.getElementById('afstand').value = afstand;
alert(afstand);
}
displaying the results is going to be another issue.