您可以使用以下代码来获取URL中的checkid的值:

function getParameterByName(name, url) {
    if (!url) {
        url = window.location.href;
    }
    name = name.replace(/[\[\]]/g, "\\$&");
    var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
        results = regex.exec(url);
    if (!results) {
        return null;
    }
    if (!results[2]) {
        return '';
    }
    return decodeURIComponent(results[2].replace(/\+/g, " "));
}

var url = "http://192.168.137.1:8012/vipTaskMobile.html?taskSource=%E8%A6%81%E5%AE%A2%E4%BF%9D%E9%9A%9C%E9%80%9A%E7%9F%A5&taskKindCode=TestApp&actionUrl=https%3A%2F%2Fbamtest.ceair.com%2Fidp%2Foauth2%2Fauthorize%3Fredirect_uri%3Dhttp%3A%2F%2F10.76.20.150%3A8080%2FvipTaskOAuth%2Findex%3Fcheckid%3D17%26state%3D123456%26client_id%3DtestOA13FOIS%26response_type%3Dcode%26fromZsdh%3D1";
var checkid = getParameterByName("checkid", url);

console.log(checkid);

在上面的代码中,getParameterByName函数用于从URL中获取指定参数的值。然后,您可以将您的URL字符串传递给getParameterByName函数,并指定参数名称为"checkid",以获取checkid的值。最后,使用console.log将获取到的checkid值输出到控制台

http19216813718012vipTaskMobilehtmltaskSource=E8A681E5AEA2E4BF9DE99A9CE9809AE79FA5&taskKindCode=TestApp&actionUrl=https3A2F2Fbamtestceaircom2Fidp2Foauth22Fauthorize3Fredirect_uri3Dhttp3A2F2F1076201503

原文地址: http://www.cveoy.top/t/topic/izvy 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录