【发布时间】:2011-07-11 18:11:35
【问题描述】:
我正在创建一个共享点 Web 部件,我想在其中调用外部 javascript 文件。我在以下位置创建了 .js 文件
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\CustomJScripts
调用函数时未找到给定函数的错误。 javascript文件的位置是否错误? 以下是代码:
protected override void CreateChildControls()
{
Page.ClientScript.RegisterStartupScript(
this.GetType(),
this.ID,
"_spOriginalFormAction = document.forms[0].action;",
true);
ClientScriptManager cs = Page.ClientScript;
if (!cs.IsClientScriptIncludeRegistered("OnMouseOverScript"))
cs.RegisterClientScriptInclude(
this.GetType(),
"OnMouseOverScript",
ResolveUrl("/_layouts/CustomJScripts/MyJS.js"));
}
private void GetData(string strSchCode)
{
Table t = new Table();
TableRow tr = new TableRow();
TableCell tc = new TableCell();
tc.Attributes.Add("onmouseover", "return ShowInfo('AA');");
tr.Controls.Add(tc);
t.Controls.Add(tr);
this.Controls.Add(t);
}
【问题讨论】:
标签: javascript sharepoint-2010 web-parts