Hi, I'm new to this forum and have not much experiance with JS. I'm trying to get 2 variables showing up in 2 text boxes, but without results. I know the variables contain their data because I created a (test) alert box showing the variables, and that works. Its just that they don't show up in the text boxes. The link to the page is http://www.globalhome.eu/new_object_v2.2.php (live link is not available for me as a newbee, I'm sorry for that) The variables are called: lat lng All help is apreciated! Kind regards, Sebastiaan
This should answer your question. <label>latitude <input type="text" name="latitude" id="lat"> </label> <label>longtitude <input type="text" name="longtitude" id="lng"> </label> <script type="text/javascript"> var lng = 5; var lat = 15; document.getElementById("lat").value= lat; document.getElementById("lng").value= lng; </script> Code (markup):
Thank you Giraph for your reply! I must be doing something wrong as it doesn't work for me The updated version with your script can be seen at: http://www.globalhome.eu/new_object_v2.3.php Kind regards, Sebas.
Hi Giraph, It does work (got it to work). I had the variables called before they where created By simply changing the position of your solution it worked! Thanks again! Kind regards, Sebas.