我的代码是收货反馈
在JS代码中我想通过jquery的offset来获取点击元素的位置,
function fun(a, x) {
alert(a.offset().top);
}
这样会出错,请问如果在fun函数中获取元素的位置?
[color=red]注:可能有的人会想说是可以通过$("a").click(function($(this).offset()...)),我的a标签是动态生成的,在点击a标签后还得传些参数进去的..所以我才另外定义fun函数...[/color]
[b]问题补充:[/b]
直接$(thisObj)不行..我试过了..出现如下错误:
[color=red]uncaught exception: [Exception... "Could not convert JavaScript argument arg 0 [nsIDOMViewCSS.getComputedStyle]" nsresult: "0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)" location: "JS frame :: http://192.168.1.100:81/Js/jquery.pack.js :: anonymous :: line 11" data: no][/color]
[b]问题补充:[/b]
$(document.getElementById("xxx")).offset().left这样是行的..可是通过 this传进来的话$(thisObj)就不成了..不知道怎么回事...晕...