I'm trying to overlay a textbox over my map for easy search. However,
when I click on the box, it gains focus for a fraction of a second and
then switch back to the map. How can I keep the focus on the textbox?
Here's my code:
function createMap(){
var mapSize = new YSize(738,500);
var map = new
YMap(document.getElementById('map'),YAHOO_MAP_REG,mapSize);
var zoomPos = new YCoordPoint(5,30);
map.addZoomShort(zoomPos);
var searchPos = new YCoordPoint(5,5);
var ob = YUtility.createNode('div','search');
ob.innerHTML = '<p><input id="searchBox" type="text"
name="search" value="Search a friend"
onkeypress="checkEnter(map,event);" onfocus="this.value = \'\';"
onblur="this.value = \'Search a friend\';"/></p>';
style = {position:'absolute',
overflow:'visible',
zIndex:2,
border:'solid purple 1px'};
YUtility.setStyle(ob,style);
mo = new YCustomOverlay(searchPos,ob);
YEvent.Capture(mo,EventsList.MouseClick,function(){document.getElementById('sear\
chBox').focus();})
map.addOverlay(mo);
map.drawZoomAndCenter("United States", 15);
return map;
}