可能重复:
在 JavaScript 中获取查询字符串值
链接是
http://nycs00058260/sites/usitp/_layouts/CreateWebPage_DingDing.aspx?List={74AB081E-59FB-45A5-876D-284607DA03C6}&RootFolder=%3b&Text=%27MDNSO%27
如何使用javascript从url解析参数“Text”(最后)?
任何人都可以帮助我吗?
可能重复:
在 JavaScript 中获取查询字符串值
链接是
http://nycs00058260/sites/usitp/_layouts/CreateWebPage_DingDing.aspx?List={74AB081E-59FB-45A5-876D-284607DA03C6}&RootFolder=%3b&Text=%27MDNSO%27
如何使用javascript从url解析参数“Text”(最后)?
任何人都可以帮助我吗?
URI.js是一个小型库,它使处理 URL 变得又好又容易 :)
var url = new URI("http://nycs00058260/sites/usitp/_layouts/CreateWebPage_DingDing.aspx?List={74AB081E-59FB-45A5-876D-284607DA03C6}&RootFolder=%3b&Text=%27MDNSO%27");
var queryMap = URI.parseQuery(url.query());
var text = queryMap["Text"];
console.log("Text: ", text);
您可以结合 window.location.search :https ://developer.mozilla.org/en-US/docs/DOM/window.location
与 indexOf :https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/indexOf
和子字符串:https ://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/substring