简体   繁体   English

如何在javascript中添加网址

[英]how to add url in javascript

I have an noob issue with javascript. 我对javascript有一个菜鸟问题。 I did search the internet how to add a url in javascript, but I cannot figure it out. 我确实在互联网上搜索了如何在javascript中添加网址,但无法弄清楚。

I have the following items, but I want it clickable with an url behind it. 我有以下项目,但我希望它可单击,后面带有一个网址。 Does anyone know how to do this in the following code. 有谁知道如何在以下代码中执行此操作。

$(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": "---------",


    }

});

}); });

The context menu provides a callback. 上下文菜单提供了回调。

 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": "---------",


}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM