我正在使用这个功能:
$("#tooltip").animate({ left: event.clientX, top: event.clientY });
Run Code Online (Sandbox Code Playgroud)
它在Chrome和IE上工作但在Firefox中我收到此错误:
ReferenceError: event is not defined $("#tooltip").animate({ left:
event.clientX, top: event.clientY });
Run Code Online (Sandbox Code Playgroud)
我怎么解决这个问题?
我有这个代码:
var mapcity = new Array([]);
$.ajax({
type: 'GET',
url: '/home/DrawMap',
dataType: 'json',
success: function (data) {
var len = data.length;
for (var i = 0; i < len; i++) {
// mapcity['' + data[i].name + ''] = { center: new google.maps.LatLng(data[i].x, data[i].y), population: data[i].population, name: '' + data[i].name + '' };
mapcity['' + data[i].name + ''] = { center: new google.maps.LatLng(data[i].x, data[i].y), population: data[i].population, name: ''+data[i].name+'' };
//newarr[i] = data[i].name;
alert(mapcity[0].population)
}
}
});
}
Run Code Online (Sandbox Code Playgroud)
这是我的代码的一部分,这是来自控制器的功能:
public ActionResult DrawMap() …Run Code Online (Sandbox Code Playgroud) 我试图在div中动态附加复选框.
我想要一个javascript函数来执行以下操作:
这是我到目前为止所做的:
var chkArray = [];
$(".Checked:checked").each(function () {
chkArray.push($(this).attr("id"));
});
var selected;
selected = chkArray.join(',') + ",";
if (selected.length > 1) {
return chkArray;
}
Run Code Online (Sandbox Code Playgroud)