Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/list/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
List 获取URL参数-sharepoint_List_Url_Sharepoint - Fatal编程技术网

List 获取URL参数-sharepoint

List 获取URL参数-sharepoint,list,url,sharepoint,List,Url,Sharepoint,我正在尝试从我的URL中提取一个ID,并将其粘贴到sharepoint列表中的ID文本框中,我尝试过这样做: <script type=”text/javascript”> function GetQueryStringParams(sParam) { var sPageURL = window.location.search.substring(1); var sURLVariables = sPageURL.split('&'); for (va

我正在尝试从我的URL中提取一个ID,并将其粘贴到sharepoint列表中的ID文本框中,我尝试过这样做:

<script type=”text/javascript”>
function GetQueryStringParams(sParam)
{
    var sPageURL = window.location.search.substring(1);
    var sURLVariables = sPageURL.split('&');

    for (var i = 0; i < sURLVariables.length; i++)
    {
        var sParameterName = sURLVariables[i].split('=');
        if (sParameterName[0] == sParam)
            {
            return sParameterName[1];
            }
    }
}​
   document.forms['aspnetForm'].ctl00_m_g_d9f5e4f9_7e05_4a4d_88b7_a6b1dcdda667_ctl00_ctl01_ctl00_ctl00_ctl00_ctl04_ctl00_ctl00_TextField.value=GetQueryStringParams(‘ID’);
</script>
我把它作为web部件xml放在我的web上

你知道我做错了什么吗?:)


感谢您的帮助

使用下面的函数作为
getQueryVariable('source')

函数getQueryVariable(变量){ var query=window.location.search.substring(1); var vars=query.split('&'); 对于(变量i=0;i刚刚尝试过,我已经修改了:document.forms['aspnetForm'].ctl00\u m_g_d9f5e4f9\u 7e05\u 4a4d\u 88b7\u a6b1dcdda667\u ctl00\u ctl01\u ctl00\u ctl00\u ctl04\u ctl00\u ctl00\u TextField.value=getQueryVariable('ID');-但仍然没有成功…:(您能检查您的文本框是否未设置或值是否未正确返回吗?hmmm允许在值正确返回时启动…我可能可以在我的xml web部件上显示结果,但如何显示?(很抱歉,可能是明显的问题)首先您可以将其登录到控制台,如console.log(“测试”);我希望您知道如何打开IE/Chrome上的控制台窗口
http://Lists/Systems%20Survey/NewForm.aspx?Source=http://Lists/Systems%2520Survey/overview.aspx&ID=14-01234
function getQueryVariable(variable) {
    var query = window.location.search.substring(1);
    var vars = query.split('&');
    for (var i = 0; i < vars.length; i++) {
        var pair = vars[i].split('=');
        if (decodeURIComponent(pair[0]) == variable) {
            return decodeURIComponent(pair[1]);
        }
    }
    console.log('Query variable %s not found', variable);
}