2011-03-15 26 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;