As far as I understand, the value may be received from google method as
response.routes[0].legs[0].distance.textJust add a variable containing this value and assign it as a 'value' property to the...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
Almost all you need is to add javascript to perform calculations.
I have completely refactored the structure of your "calculator" and added some scripting. It works in all browsers since the old way...