html href页面跳转获取参数

 

 //传递参数

var id = columnData.id;

var companyname = encodeURI(columnData.companyname);

var linename = encodeURI(columnData.linename);

text = text + "<a href='/hylm/html/basicdata/transit/updatetransit.html?id=" + id + "&companyname=" + companyname + "'>修改</a>  ";

 

 

/**
 * 页面获取参数方法
 * @param name
 * @returns
 */
var LocString = String(window.document.location.href);
function GetQueryString(name) {
    var rs = new RegExp("(^|)" + name + "=([^&]*)(&|$)", "gi").exec(LocString), tmp;
    if (tmp = rs) {
        return decodeURI(tmp[2]);
    }
    // parameter cannot be found
    return "";
}

 

 

//新页面获取列表页面传来的参数

var id = GetQueryString("id");
var companyname = GetQueryString("companyname");
var linename = GetQueryString("linename");

 

你可能感兴趣的:(html)