Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/sharepoint/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
Javascript 为对象参数赋值_Javascript_Sharepoint - Fatal编程技术网

Javascript 为对象参数赋值

Javascript 为对象参数赋值,javascript,sharepoint,Javascript,Sharepoint,我在sharepoints中嵌入了代码。我需要将javascript值传递给参数。我在这里怎么做?请参阅第三个参数,将函数值放在此处以供参考 <script type="text/javascript"> function getUrlParameters(parameter, staticURL, decode){ /* Function: getUrlParameters Description: Get the value of URL parameter

我在sharepoints中嵌入了代码。我需要将javascript值传递给参数。我在这里怎么做?请参阅第三个参数,将函数值放在此处以供参考

<script type="text/javascript">
function getUrlParameters(parameter, staticURL, decode){
   /*
    Function: getUrlParameters
    Description: Get the value of URL parameters either from 
                 current URL or static URL
    Author: Tirumal
    URL: www.code-tricks.com
   */
   var currLocation = (staticURL.length)? staticURL : window.location.search,
       parArr = currLocation.split("?")[1].split("&"),
       returnBool = true;

   for(var i = 0; i < parArr.length; i++){
        parr = parArr[i].split("=");
        if(parr[0] == parameter){
            return (decode) ? decodeURIComponent(parr[1]) : parr[1];
            returnBool = true;
        }else{
            returnBool = false;            
        }
   }

   if(!returnBool) return false;  
}
function getUrlParametersWrite(parameter, staticURL, decode){
                var vlaue = getUrlParameters(parameter, staticURL, decode);
                alert(value);
                document.write(value);
                document.close();
}

</script>


<script type='text/javascript' src='http://myview.fake.org/javascripts/api/viz_v1.js'></script>
<div class='tableauPlaceholder' style='width: 984px; height: 634px;'>
    <object class='tableauViz' width='984' height='634' style='display:none;'>
        <param name='host_url' value='http://myview.fake.org' /> 
        <param name='site_root' value='' />
        <param name='name' value='MemberParticipationReporting&#47;MemberParticipationDashboard&Fice=PUT_FUNCTION_VALUE_HERE' />
        <param name='tabs' value='yes' />
        <param name='toolbar' value='yes' />
    </object>
</div>

函数getUrlParameters(参数、静态URL、解码){
/*
函数:getUrlParameters
描述:从以下两种方法中获取URL参数的值
当前URL或静态URL
作者:Tirumal
网址:www.code-tricks.com
*/
var currLocation=(staticURL.length)?staticURL:window.location.search,
parArr=currLocation.split(“?”[1]。split(“&”),
returnBool=true;
对于(变量i=0;i
使用jQuery,这将非常简单

function getUrlParametersWrite(parameter, staticURL, decode){
  var value = getUrlParameters(parameter, staticURL, decode);
  var att = $("param[name='name']").attr("value");
  att = att.replace("PUT_FUNCTION_VALUE_HERE",value);
  $("param[name='host_url']").attr("value",att);
}
我假设您正在尝试设置主机url参数

对于straight JavaScript,这应该可以工作:

function getUrlParametersWrite(parameter, staticURL, decode){
  var value = getUrlParameters(parameter, staticURL, decode);
  var params = document.getElementsByName("name");
  var att = params[0].getAttribute("value");
  att = att.replace("PUT_FUNCTION_VALUE_HERE",value);
  params[0].setAttribute("value",att);
}

我需要将该值附加到以下