小编mot*_*ana的帖子

ReferenceError:在Firefox中未定义事件

我正在使用这个功能:

$("#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)

我怎么解决这个问题?

javascript firefox jquery

3
推荐指数
1
解决办法
6612
查看次数

使用MVC中的JSON将数组从控制器发送到视图

我有这个代码:

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)

asp.net-mvc jquery json

0
推荐指数
1
解决办法
1万
查看次数

获取div中所有已选中复选框的ID

我试图在div中动态附加复选框.

我想要一个javascript函数来执行以下操作:

  • 当我选中一个复选框时:将其id添加到数组中.
  • 当我取消选中一个复选框时:从该数组中删除id.

这是我到目前为止所做的:

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)

javascript jquery

0
推荐指数
1
解决办法
8363
查看次数

标签 统计

jquery ×3

javascript ×2

asp.net-mvc ×1

firefox ×1

json ×1