为什么getAttribute返回null



我使用的是dynamics CRM。我已经创建了一个HTML网络资源,并添加到联系人表单。代码,

<html>
<head>
    <title>OData</title>
    <meta charset="utf-8">
</head>
<body>
    <script type="text/javascript">
        function getAllAttribute() {
            document.getElementById("demo").innerHTML = Xrm.Page.getAttribute();
        }
    </script>
    <button onclick="getAllAttribute();">Attributes!</button>
    <p id="demo">Value will be displayed here</p>
</body>
</html>

现在,当我点击属性按钮,demo段落为空,为什么没有给出页面上所有属性的名称?

可以使用window.parent.Xrm.Page.data.entity.attributeswindow.parent.Xrm.Page.getAttribute()而不是Xrm.Page.getAttribute();

请参见此处:http://msdn.microsoft.com/en-in/library/gg328474.aspx

最新更新