簡體   English   中英

設置 document.title 在 Dynamics CRM 2011 JScript 中不起作用

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM