![](/img/trans.png)
[英]Resources for customizations with jscript in Dynamics CRM 2011
[英]Setting document.title not working in Dynamics CRM 2011 JScript
我正在 MS Dynamics CRM 2011 表单上的 OnLoad 事件中运行一段 JScript 代码,并希望通过脚本设置文档标题(即该页面的 IE 窗口/选项卡中显示的内容)。
我打了以下电话:
document.title = newtext;
但这不起作用。 当我使用 F12 检查正在发生的事情时,我看到预先存在的 document.title 值是“Holding:”。 但是,浏览器中实际选项卡的 document.title 是“Holding: - Microsoft Dynamics CRM”
我认为问题可能在于我在子表单(或者可能是 iFrame?)中工作,而不是在用户导航到的实际文档中工作。 有什么办法可以设置父文档的标题吗?
不确定这是否适合您,但这是我们的 setDisplayName 函数,它更新标题和 CRM Div 显示名称:
/*
Updates the display name of the entity, both in the name div, and the Page Title
*/
setDisplayName: function (name) {
// Updates the Document Title
var title = parent.document.title;
var start = title.indexOf(':') + 2;
var end = title.lastIndexOf('-') - 1;
parent.document.title = title.substring(0, start) + name + title.substring(end);
// Sets the div Name
document.getElementById("form_title_div").childNodes[2].childNodes[0].innerText = name;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.