对象不支持属性或方法" EditDocument"

时间:2016-02-01 12:47:48

标签: javascript webdav activexobject

我正在尝试运行以下代码,但是它会提示我一个错误:对象不支持属性或方法" EditDocument"。任何人都可以帮我解决这个错误的原因吗?

<object id="winFirefoxPlugin" type="application/x-sharepoint" width="0" height="0" style="visibility: hidden;">Test-2.docx</object><a onclick='javascript: editDocument();' href='#'>Word Doc</a>

<script>
    var fNewDoc = false;
    $(document).ready(function () {

        var fNewDoc = false;
        var EditDocumentButton = null;
        try {
            EditDocumentButton = new ActiveXObject('SharePoint.OpenDocuments.2');
            if (EditDocumentButton != null) {
                fNewDoc = true;
            }
        } catch (e) {
        }
    });

    var L_EditDocumentError_Text = "Editing not supported.";
    var L_EditDocumentRuntimeError_Text = "Sorry, couldn't open the document.";

    function editDocument() {
        if (fNewDoc) {
            if (!EditDocumentButton.EditDocument(strDocument)) {
                alert(L_EditDocumentRuntimeError_Text);
            }
        } else {
            try {
                var hownowPlugin = document.getElementById("winFirefoxPlugin");
                hownowPlugin.EditDocument('http://localhost:46961/wordstorage/Test-2.docx', null);
            } catch (e) {
                alert(L_EditDocumentError_Text);
            }
        }
    }

</script>

此致

1 个答案:

答案 0 :(得分:0)

您用来测试此内容的浏览器是什么?

这应该适用于IE和FireFox浏览器。

 JSONObject object = new JSONObject(jsonResult);

            JSONOArray details = object.getJSONArray("Details");

           for (int i = 0; i < details.length(); i++) {
             JSONObject c = details.getJSONObject(i);

            String status = c.getString("Status");
            }
            Toast.makeText(getBaseContext(), "Please wait...",100).show();