我有javascript的noob问题。我在网上搜索了如何在javascript中添加网址,但我无法弄明白。
我有以下项目,但我希望它可以点击后面的网址。 有谁知道如何在以下代码中执行此操作。
$(function(){
$.contextMenu({
selector: '.context-menu-one',
trigger: 'left',
items: {
"Ship": {name: "Ship Expedite", icon: "paste"},
"Request": {name: "Request information", icon: "edit"},
"Reminder": {name: "Send reminder", icon: "reminder"},
"Inbound": {name: "Request Inboud", icon: "copy"},
"delete": {name: "Delete expedite", icon: "delete"},
"sep1": "---------",
}
});
});
答案 0 :(得分:0)
上下文菜单提供回调。
items: {
"Ship": {
name: "Ship Expedite",
icon: "paste",
callback: function(key, options) {
// Do your page redirection here.
window.location.href('www.yoursite.com/shippingpage');
}},
"Request": {name: "Request information", icon: "edit",
callback: function(key, options) {
// Do your page redirection here.
window.location.href('www.yoursite.com/requestpage');
}},
"Reminder": {name: "Send reminder", icon: "reminder"},
"Inbound": {name: "Request Inboud", icon: "copy"},
"delete": {name: "Delete expedite", icon: "delete",
callback: function(key, options) {
// delete item or whatever using ajax possibly?
// eg. $.post('www.yoursite.com/deleteitem',{id:key});
}}
},
"sep1": "---------",
}