我正在使用谷歌地图,点击标记打开的信息窗口调用 JavaScript 函数。
必须从此函数调用另一个具有多个参数的函数。
以下是我的代码:
function createMarker(point,custid,streetadd,city,state,zip,address,phone,website,co) {
var infowindowHover,infowindowClick;
var hoverText = "<CENTER><B>" + co + "</B></CENTER>";
var markerMarkup = "<TABLE><TR><TD colspan='2'><B>";
markerMarkup = markerMarkup + co + "</B></TD></TR><TR><TD colspan='2'>";
markerMarkup = markerMarkup + streetadd + "</TD></TR><TR><TD colspan='2'>";
markerMarkup = markerMarkup + city + "," + state + " " + zip + "</TD></TR><TR><TD colspan='2'>";
markerMarkup = markerMarkup + phone + "</TD></TR><TR><TD colspan='2'>";
if(website.indexOf("http://")>0) {
markerMarkup = markerMarkup +"<a href=";
} else {
markerMarkup = markerMarkup +"<a href=http://";
}
markerMarkup = markerMarkup + website + " target=_blank>" + website + "</a></TD></TR><TR><TD>";
var funCall = custid + "," + streetadd + "," + city + "," + state + "," + zip + "," + address + "," + phone + "," + website + "," + co;
markerMarkup = markerMarkup + "<input type='button' class='button' value='see available styles' id='styles' onclick='setstyles("+ funCall +");'></input>";
//markerMarkup = markerMarkup + "<input type='button' class='button' value='see available styles' id='styles' onclick='setstyles("+ custid +");'></input>";
markerMarkup = markerMarkup + "</TD></TR></TABLE>";
var marker = new google.maps.Marker({
position: point,
map: map,
icon: image
});
google.maps.event.addListener(marker, "mouseover", function () {
if (infowindowHover) infowindowHover.close();
infowindowHover = new google.maps.InfoWindow({content: hoverText});
infowindowHover.open(map, marker);
});
google.maps.event.addListener(marker, "mouseout", function () {
if (infowindowHover) infowindowHover.close();
});
google.maps.event.addListener(marker, "click", function () {
if (infowindowClick) infowindowClick.close();
infowindowClick = new google.maps.InfoWindow({ content: markerMarkup });
infowindowClick.open(map, marker);
});
//google.maps.event.addListener(marker, "mouseout", function () {
// if (infowindowClick) infowindowClick.close();
//});
return marker;
}
我想从此函数调用的第二个函数是:
function setstyles(idcust,streetadd,city,state,zip,address,phone,website,co){
var msg= "This feature is available only to logged-in ";
alert(idcust);
<%if Session("ctype")="1" then %>
alert(msg + " non wholesalers.");
<%else %>
<%if Session("ctype")="0" then %>
var storestyles = 'storestyles.asp?id=' + idcust;
document.getElementById('storeaddresses').style.display = 'block';
<%else %>
alert(msg + "users.");
<% end if %>
<%end if %>
}
我想将参数从 传递createMarker()
给setstyles()
目前我无法做到的。