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>
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>