【发布时间】:2018-11-24 05:23:00
【问题描述】:
我在保存会话后尝试将我的网页重定向到我的 asp.net 项目的另一个路径,代码在此处:
(function (marker, data) {
google.maps.event.addListener(marker, "click", function (e) {
infoWindow.setContent('<div class="card" style ="width:200px;height:auto;">' +
'<img class="card-img-top" src='+data.photo+' style="width:200px;height:auto;" >' +
'<div class="card-body">'+
'<h5 class="card-title">' + data.title + '</h5>' +
'<p class="card-text">' + data.description + '</p>' +
'<button id="btn_seedetails" >Click me</button>' +
'</div>' +
'</div >' );
infoWindow.open(map, marker);
google.maps.event.addDomListener(document.getElementById('btn_seedetails'), 'click', sendit);
});
function sendit() {
'<%Session["ID_EVENT"] = "' + data.id + '"; %>';
document.location.href = "AllConflicts.aspx";
location.replace("AllConflicts.aspx")
}
})(marker, data);
【问题讨论】:
-
浏览器控制台说什么?
-
说:未捕获
-
您要添加多少个标记?因为它们都有一个具有相同 ID 的按钮。您还可以在 html 中使用
data-id="342"并在 sendit/clicked 函数中访问该 id -
我添加了许多标记,因为数据库有
标签: asp.net google-maps button onclick infowindow