2011-03-15 28 views

回答

1

这些添加到您的窗体(如果它们不存在):

<input type="hidden" value="" id="lat" name="lat" /> 
<input type="hidden" value="" id="lng" name="lng" /> 

然后,一旦你要更新的值只是做:

document.getElementById("lat").setAttribute("value", newLat); 
document.getElementById("lng").setAttribute("value", newLng); 
2

如果表单中已经包含了隐藏的输入字段,这些字段有ID,您可以做

document.getElementById("id of the input field").value = myVariable;