SharePoint with jQuery将禁用页面滚动、功能区或单击
我将以下jquery保存在一个文件中并上传到资产库。我在内容编辑器web部件中引用该文件。jquery代码为什么会禁用ribbonSharePoint with jQuery将禁用页面滚动、功能区或单击,jquery,sharepoint,Jquery,Sharepoint,我将以下jquery保存在一个文件中并上传到资产库。我在内容编辑器web部件中引用该文件。jquery代码为什么会禁用ribbon <script src="http://inside.nov.com/_layouts/jquery/jquery-1.11.0.min.js"></script> <script src="http://inside.nov.com/_layouts/jquery/jquery-ui-1.10.4/jquery-ui.min.js"&
<script src="http://inside.nov.com/_layouts/jquery/jquery-1.11.0.min.js"></script>
<script src="http://inside.nov.com/_layouts/jquery/jquery-ui-1.10.4/jquery-ui.min.js"></script>
<script src="http://inside.nov.com/_layouts/jquery/jquery.SPServices-2014.01.min.js"></script>
<link rel="stylesheet" href="http://inside.nov.com/_layouts/jquery/jquery-ui-themes-1.10.4/themes/smoothness/jquery-ui.css" />
<script type="text/javascript">
$(document).ready(function() {
// Hide Text Filter Control
var controlID = "ctl00_m_g_ae01f1bd_e6a3_4044_8045_ab8b29c41f89_SPTextSlicerValueTextControl";
//$("input[id$='"+ controlID +"']").closest("tr").hide();
document.getElementById("MSOZoneCell_WebPartWPQ3").style.display='none';
$('#btnSearch').click(moveValue); //this works too
//$('#btnSearch').on('click', moveValue); //this works too
var externalParties = [];
window.onload = function() {
window.setTimeout(readyCall, 1000);
}
function readyCall(){
var externalParties = [];
$().SPServices({
operation: "GetListItems",
listName: "EmployeeBasicData",
CAMLViewFields: "<ViewFields> <FieldRef Name='FullName' /> </ViewFields>",
async: false,
completefunc: function (xData, Status) {
$(xData.responseXML).SPFilterNode("z:row").each(function() {
externalParties.push($(this).attr("ows_FullName"));
});
}
});
$("#EmployeeName").autocomplete({
source: externalParties,
minLength: 3
});
}
});
//<!--<input type="button" value="OK" id="btnSearch" name="btnSearch" onclick="moveValue()"/> -->
</script>
<script type="text/javascript">
function moveValue() {
var employeeField = document.getElementById("EmployeeName");
var otherControl = document.getElementById("ctl00_m_g_ae01f1bd_e6a3_4044_8045_ab8b29c41f89_SPTextSlicerValueTextControl");
//Making sure both fields are not undefined before accessing their properties.
if(employeeField && otherControl){
otherControl.value = employeeField.value;
__doPostBack('<%= btnSearch.UniqueID %>','')
}else{
//Use for debugging, delete comment once done
alert("employeeField: " + employeeField + ", otherControl: " + otherControl);
}
}
</script>
<div class="ui-widget">
<label for="EmployeeName">Employee Name</label>
<input type="text" size="40" id="EmployeeName">
<input type="button" value="OK" id="btnSearch" name="btnSearch" />
</div>
$(文档).ready(函数(){
//隐藏文本过滤器控件
var controlID=“ctl00\u m\u g\u ae01f1bd\u e6a3\u 4044\u 8045\u ab8b29c41f89\u SPTextSlicerValueTextControl”;
//$(“输入[id$='”+controlID+“]])。最近的(“tr”).hide();
document.getElementById(“MSOZoneCell_WebPartWPQ3”).style.display='none';
$('#btnSearch')。单击(moveValue);//这也可以
//$('#btnSearch')。在('click',moveValue);//这也有效
var externalParties=[];
window.onload=函数(){
设置超时(readyCall,1000);
}
函数readyCall(){
var externalParties=[];
$().SPServices({
操作:“GetListItems”,
列表名:“EmployeeBasicData”,
CAMLViewFields:“”,
async:false,
completefunc:函数(扩展数据、状态){
$(扩展数据.responseXML).SPFilterNode(“z:row”).each(函数(){
externalParties.push($(this.attr(“ows_全名”);
});
}
});
$(“#员工姓名”).autocomplete({
资料来源:外部当事人,
最小长度:3
});
}
});
//
函数moveValue(){
var employeeField=document.getElementById(“EmployeeName”);
var otherControl=document.getElementById(“ctl00_m_g_ae01f1bd_e6a3_4044_8045_ab8b29c41f89_SPTextSlicerValueTextControl”);
//在访问两个字段的属性之前,请确保这两个字段都未定义。
if(员工字段和其他控件(&O){
otherControl.value=employeeField.value;
__doPostBack('','')
}否则{
//用于调试,完成后删除注释
警报(“employeeField:+employeeField+”,otherControl:+otherControl);
}
}
员工姓名
您的脚本是否有任何错误?页面上的任何脚本错误都可能阻止SharePoint滚动或响应功能区交互。我添加了开发人员工具的打印快照。我看到的唯一错误是“SEC7115::visited和:link样式只能因颜色不同而不同。某些样式未应用于:visited”。我是否应该在其他任何地方查找脚本错误或其他错误。否,如果脚本生成错误,它应该显示在控制台中。我看不出你的剧本有什么明显的错误;在这种情况下,我想我应该开始对其中的部分进行注释,以缩小导致SharePoint崩溃的具体原因。我试过了,但没用。还有其他想法吗?