2010-03-16 140 views
9

我想添加一個自定義控件到我的谷歌地圖(V3):我想有一個搜索框只是附近的其他地圖控件。所以我在其上添加一個<input type="textbox">的div,並將其顯示在地圖上。但問題在於文本框無法訪問:我無法在其中輸入任何內容,甚至不能關注它。谷歌地圖v3,與文本框自定義控件:無法執行輸入

function SearchBox() { 
    var searchTextBox = $('<input type="text" id="txtGeoSearch" />'); 

    var div = $('<div class="geoSearchBox"></div>') 
     .append($('<span>Search:</span>')) 
     .append(searchTextBox); 

    return div.get(0); 
} 

// inside init() 
geoMap.controls[google.maps.ControlPosition.TOP_LEFT].push(new SearchBox()); 

那麼,我應該怎麼做才能讓我的文本框像正常的那樣行事?

回答