代码之家  ›  专栏  ›  技术社区  ›  Raghu

如何从dynamics CRM表单2016中访问元素/DOM对象

  •  1
  • Raghu  · 技术社区  · 8 年前

    出于试用目的,我需要更改CRM dynamics 2016中CRM表单通知元素的背景颜色。我知道它不受支持,但这是供最终用户试用的。div元素详细信息如下-

    <div class="Notifications Notifications-strict Notifications-strict-bottom" id="crmNotifications" style="height:; display: block;" size="3" maxheight="51">
    

    我试过使用 window.parent.getElementById('crmNotifications').style.backgroundColor;

    但是没有运气。我还听说DOM元素不能从实体表单中访问。有什么方法可以更改背景颜色吗。

    2 回复  |  直到 8 年前
        1
  •  1
  •   Cavan Page    8 年前
    document.getElementById("crmNotifications").style.backgroundColor = "blue"
    
        2
  •  0
  •   Axifive Sufiyan Ghori    6 年前

    您需要创建一个HTML web资源,将其添加到表单并使用窗口。父对象访问DOM。

    <html>
     <head>
      <script>
        window.parent.document.getElementById("crmNotifications").style.backgroundColor = "blue"
      </script>
     </head>
     <body>
     </body>
    </html>