0
有了這個代碼上下文菜單中,我得到JSON數據,但我只是想表明一個上下文菜單.. 您可以修改這個代碼..如何生成與下面的代碼
switch (htmlTagName) {
case 'a':
alert('a'+'isShiftExists:'+isShiftExists+'length:'+jQ(this).parents('td').find('div.wb_sm_m').length);
if (jQ(this).parents('td').find('div.wb_sm_m').length > 0 && isShiftExists != -1) {
//loop json array to build context menu
jQ(this).parents('td').find('div.wb_sm_m').each(function() {
var jsonArr = JSON.parse(jQ(this).text()); //jsonArr contains the json array
alert(JSON.stringify(jsonArr));
//loop items of the json array to find context menu item and link
// jQ.each(jsonArr, function(key, val) {
//
// });
});
}
break;
case 'td':
alert('td'+'isShiftExists:'+isShiftExists+'length:'+jQ(this).find('div.wb_sm_m').length);
if (jQ(this).find('div.wb_sm_m').length > 0 && isShiftExists != -1) {
//loop json array to build context menu
jQ(this).find('div.wb_sm_m').each(function() {
var jsonArr = JSON.parse(jQ(this).text()); //jsonArr contains the json array
alert(JSON.stringify(jsonArr));
});
}
break;
default:
break;
}