我正在使用谷歌地图API,其中我使用ajax加载两个下拉列表。这两个下拉都不是可点击的,而是我使用tab键来改变下拉,有人可以帮我解决这个问题。
这是html
<div id="Layer1">
<select name="delivery_center" id="delivery_center">
<option value="">--Please Select--</option>
<?php foreach($DeliveryCenters as $dlvryData):?>
<option value="<?php if($dlvryData['delivery_center_name'] == 'Chennai') echo 'Others';else echo $dlvryData['delivery_center_name'];?>" <?php if(isset($_GET['rgn']) && $dlvryData['delivery_center_name']==$_GET['rgn']) echo "selected";?>><?php echo $dlvryData['delivery_center_name'];?></option>
<?php endforeach;?>
</select>
</div>
<div id="Layer2">
<select name="myList3[]" id = "myList3" onchange="loadPg(this.value)">
<option value="">--Please Select--</option>
<?php foreach($acName as $acData):?>
<option value="<?php echo $acData['AccountName'];?>" <?php if(isset($_GET['acId']) && $acData['AccountName']==$_GET['acId']) echo "selected";?>><?php echo $acData['AccountName'];?></option>
<?php endforeach;?>
</select>
</div>
这是ajax
var geocoder;
var directionsService;
var directionsDisplay;
var markers = [];
var map;
//Start of code (above is framework)
function initialize() {
var myLatLng = new google.maps.LatLng(16.341130, -5.390013);
var mapOptions = {
zoom: 2,
center: myLatLng,
mapTypeId: google.maps.MapTypeId.ROADMAP,
disableDefaultUI: true,
};
//Map Framework above
var map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions); //Map Options
//google.maps.event.addDomListener(document.getElementById('SelectList'),
// 'change', function() {}
//var mypos = document.getElementById('SelectList').value;
<?php
if(isset($_GET['acId']))
{
$incVal = 1;
if($_GET['rgn'] == 'India'){
$info = $func->getIndiaAccountsData($con, $_GET['acId']);}
else
$info = $func->getRegionwiseAccountsData($con, $_GET['rgn'], $_GET['acId']);
$cityArr = $info[0];
$ledArr = array("Breached", "InOrder", "CheckPointed");
$fnArr = $info[1];
$dupArr = array_count_values($info[2]);
$olaHydFinal = "";$olaNoiFinal = "";$olaOthFinal = "";
$unqcityArr = array_values(array_unique($cityArr));
print_r($unqcityArr);echo '<br>';print_r($fnArr);echo '<br>';print_r($dupArr);echo '<br>';
for ($inc1=0;$inc1<count($unqcityArr);$inc1++){
$coOrd = $coRes['Impacted_Locations'].",";
//$coOrd = substr($coOrd,0,-1);
$spt0 = explode(",", $coOrd);//print_r($spt0);echo count($spt0);
for($inc=0;$inc<count($spt0);$inc++){
if($spt0[$inc]!=""){
$coQry1Cnt = mysqli_num_rows(mysqli_query($con, "select * from coordinates_mst where Coordinate_Name='".$spt0[$inc]."'"));
if($coQry1Cnt>0){
$coQry1 = mysqli_fetch_assoc(mysqli_query($con, "select * from coordinates_mst where Coordinate_Name='".$spt0[$inc]."'"));
?>
// Marker<?php echo $incVal;?> (Red - default marker color)
var latLng<?php echo $incVal;?> = new google.maps.LatLng(<?php echo $coQry1['latitude'];?>, <?php echo $coQry1['longitude'];?>);
var contentString<?php echo $incVal;?> = "<div id='content'><a onclick=\"window.open(\'incident-details.php?id=<?php echo $coRes['Incident_Number'];?>\',\'Incident Summary\',\'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, width = 950, top=150, left=200\');\"><?php echo $coRes['Incident_Number'];?></a></div>";
var infowindow<?php echo $incVal;?> = new google.maps.InfoWindow({
content: contentString<?php echo $incVal;?>
});
var marker<?php echo $incVal;?> = new google.maps.Marker({
position: latLng<?php echo $incVal;?>,
icon: src = 'Images/rednew1.gif',
optimized: false,
//new google.maps.Size(42,68)
//size: (12, 10),
//position: mypos,
map: map,
title: "<?php echo $coQry1['Coordinate_Name'];?>" //hover
});
markers[<?php echo $incVal;?>] = marker<?php echo $incVal;?>;
google.maps.event.addListener(marker<?php echo $incVal;?>, 'click', function () {
infowindow<?php echo $incVal;?>.open(map, marker<?php echo $incVal;?>);
});
//moved 'SelectList' up toward top!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// End code for Marker
<?php $incVal++;}}}}}else{
$incVal = 1;
foreach($acName as $acData):
$coQry = mysqli_query($con, "select * from map_coordinates where Account_id=".$acData['Id']);
while($coRes = mysqli_fetch_assoc($coQry)){
$coOrd = $coRes['Coordinate_id'].",";
//$coOrd = substr($coOrd,0,-1);
$spt0 = explode(",", $coOrd);//print_r($spt0);echo count($spt0);
for($inc=0;$inc<count($spt0);$inc++){
if($spt0[$inc]!=""){
$coQry1Cnt = mysqli_num_rows(mysqli_query($con, "select * from coordinates_mst where id=".$spt0[$inc]));
if($coQry1Cnt>0){
$coQry1 = mysqli_fetch_assoc(mysqli_query($con, "select * from coordinates_mst where id=".$spt0[$inc]));
?>
// Marker<?php echo $incVal;?> (Red - default marker color)
var latLng<?php echo $incVal;?> = new google.maps.LatLng(<?php echo $coQry1['latitude'];?>, <?php echo $coQry1['longitude'];?>);
var contentString<?php echo $incVal;?> = '<div id="content"><?php echo $coQry1['Coordinate_Name'];?></div>';
var infowindow<?php echo $incVal;?> = new google.maps.InfoWindow({
content: contentString<?php echo $incVal;?>
});
var marker<?php echo $incVal;?> = new google.maps.Marker({
position: latLng<?php echo $incVal;?>,
icon: src = 'Images/rednew1.gif',
optimized: false,
//new google.maps.Size(42,68)
//size: (12, 10),
//position: mypos,
map: map,
title: "<?php echo $acData['Id'];?>" //hover
});
markers[<?php echo $incVal;?>] = marker<?php echo $incVal;?>;
google.maps.event.addListener(marker<?php echo $incVal;?>, 'click', function () {
infowindow<?php echo $incVal;?>.open(map, marker<?php echo $incVal;?>);
});
//moved 'SelectList' up toward top!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// End code for Marker
<?php $incVal++;}
}
}
}endforeach;
}?>
}
google.maps.event.addDomListener(window, 'load', initialize);
function loadPg(str) {alert(1);
window.location.href='loadaccounts.php?acId='+encodeURIComponent(str);
}
这是css
#Layer1 {
width:900px;
height:250px;
z-index:30;
left: 1%;
top: 25px;
visibility: visible;
overflow: visible;
}
#Layer2 {
position:absolute;
width:600px;
height:250px;
z-index:30;
left: 1%;
top: 50px;
visibility: visible;
overflow: visible;
}