Linking a cookie (posted in a div) to a text box to search
Hi all.
How do I link a cookie, presented in a div, to a text box on the same page - so it can be searched?
Now I have a search box that link to the Google Maps API. I also have the two most recently search items to show up as cookies below the map. My goal is to have the cookies show up as links so that when you click them, they show up in the text box to search.
I'm thinking of three ways to do this and wonder which is the best way to do it.
1) Can I just adjust the div tag to link to the text box?
2) Can I adjust the function relating to how the cookies are posted on the page?
3) Do I have to make a new function to post the cookies as links?
getRecent()
geocoder = new google.maps.Geocoder();
var latlng = new google.maps.LatLng(37.4419, -122.1419);
var myOptions = {
zoom: 13,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById("mymap"), myOptions);
}
function showAddress(theAddress) {
var myaddress = theAddress
if (geocoder) {
geocoder.geocode( { 'address': myaddress}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
map.setCenter(results[0].geometry.location);
var marker = new google.maps.Marker({
map: map,
position: results[0].geometry.location
});
} else {
alert("Geocode was not successful for the following reason: " + status);
}
});
}
}
function createRequestObject() {
var ro
var browser = navigator.appName
if(browser == "Microsoft Internet Explorer"){
ro = new ActiveXObject("Microsoft.XMLHTTP")
}else{
ro = new XMLHttpRequest()
}
return ro
}
This is the line which inserts the extracted cookie value into a DIV. All I see is:
t-factory-cc=1314511305173
Access restriction errors occur when I attempt to use anything on the page so I cannot
test anything myself without some major research. Not going to happen.
However, this is the place where you should be thinking about creating a link. Something
like this:
"somewhere.htm" is obviously something I do not quite understand. What link and to
where? What is the normal value returned from the getCookie() function? If is it a valid
URL then:
Code:
retVal='<a href="'+retVal+'">Recent Link 1</a>';
But that creates another problem, how will you know which link goes where without
valid display text?
Bookmarks