首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

这个jquery右键菜单在ajax加载的页面中,如何两个页面都显示

2012-08-29 
这个jquery右键菜单在ajax加载的页面中,怎么两个页面都显示?是这样的:我只在demo1.html中载入了右键菜单函

这个jquery右键菜单在ajax加载的页面中,怎么两个页面都显示?
是这样的:我只在demo1.html中载入了右键菜单函数,但是第二个页面demo2.html也会出现右键菜单。
不知道如何修改,请大侠们帮忙,谢谢

演示文件附件地址:http://files.cnblogs.com/public/demo.rar

下载后放到本地站点测试,因为是ajax加载,所以直接显示不了哦

[解决办法]
将index.html中的
$('#left li a').live('click',function() {
$.ajax({
type: "GET",
url: $(this).attr('link'),
cache: false,
dataType: "script"
});
})
改为
$('#left li a').live('click',function() {
if($(this).attr('link') == "demo2.html")
{
$("#datalist").rightmenu("rightClick", null, null, null);
}
$.ajax({
type: "GET",
url: $(this).attr('link'),
cache: false,
dataType: "script"
});
})

热点排行