Issue with passing js var value to a form element

D

DL

Hi,

I'm using google's client side tool that translate an IP into city and
state. It works, however, don't know why such a simple js var value
mapping to an form element failed in this case, that is, the js var
{where}'s value failed to map to the value of the form element,
'place'. Weird, I've something similar all the time, this time, it
failed, am I blind? missing something obvious?

Thanks.

<html>
<head>

<script type="text/javascript" src="http://www.google.com/jsapi?
key=ABQIAAAAp04yNttlQq-

7b4aZI_jL5hQYPm-xtd00hTQOC0OXpAMO40FHAxQMnH50uBbWoKVHwgpklyirDEregg"></
script>
<script type="text/javascript">
if(google.loader.ClientLocation)
{
visitor_city = google.loader.ClientLocation.address.city;
visitor_region = google.loader.ClientLocation.address.region;
visitor_country = google.loader.ClientLocation.address.country;
where = visitor_city + ' ' + visitor_region;
// alert(visitor_city);
// alert(visitor_region);
// alert(where);

document.getElementById('loc').innerHTML= ' + where + ';
// , ' + visitor_region;
// , ' + visitor_country)';
}
// document.getElementById('location').value = document.getElementById
('loc').innerHTML;

document.getElementById('place').value = ' + where + ';

window.location.href="loc2.html";
// document.location.href="location.html?l='+where";

</script>
</head>

<body>

<div id="loc"></div>
<form>
<input type="text" id="place">
</form>

</body>
</html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top