将URL参数输入到调查文本框中 [英] get URL parameter into the survey text box

查看:92
本文介绍了将URL参数输入到调查文本框中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将一个URL参数自动复制到共享点调查中的文本框中.

hi I am trying to get a URL parameter automatically copied to the text box in the sharepoint survey. 

例如,我的URL看起来是:

for example my URL looks: 

http://sites/system/Lists/Systems%20Survey/NewForm.aspx?Source = http%3a%2f%2fsites%2fsystem%2fLists%2fSystems%2520Survey%2foverview.aspx& RequestID = 1234

http://sites/system/Lists/Systems%20Survey/NewForm.aspx?Source=http%3a%2f%2fsites%2fsystem%2fLists%2fSystems%2520Survey%2foverview.aspx&RequestID=1234

<script type="text/javascript" language="javascript"> 
_spBodyOnLoadFunctionNames.push("GetURLParameter"); 
function GetURLParameter(sParam) 
{    
var sPageURL = window.location.hash.substring(1);    
var sURLVariables = sPageURL.split('&');    
for (var i = 0; i < sURLVariables.length; i++) 
{        
var sParameterName = sURLVariables[i].split('=');        if (sParameterName[0] == sParam) 
{
alert(sParameterName[1]);
return sParameterName[1];        }    }}

document.forms['aspnetForm'].ctl00_m_g_d9f5e4f9_7e05_4a4d_88b7_a6b1dcdda667_ctl00_ctl01_ctl00_ctl00_ctl00_ctl04_ctl00_ctl00_TextField.value=GetURLParameter('RequestID');
</script>

但是,它不起作用.

您是否知道为什么?

预先感谢

推荐答案

我还添加了简单的代码: 

I have also added simple code: 

< script type ="text/javascript" language ="javascript"> 

<script type="text/javascript" language="javascript"> 

function HelloWorld(){
alert("Hello World");
}

_spBodyOnLoadFunctionNames.push("HelloWorld"); 

function HelloWorld () {
alert("Hello World");
}

_spBodyOnLoadFunctionNames.push("HelloWorld"); 

</script>

</script>

但是我也没有弹出...知道为什么它在调查中发生了吗?当我将其添加到标准列表中时,它可以正常工作... 

but I am not getting pop up as well... any idea why it is happening on the survey? and when I add this to standard list it works... 


这篇关于将URL参数输入到调查文本框中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆