2

“对象不支持此属性或方法”发生在 javascript 中,并停在为 Liferay Portal 处理来自 applet 的方法调用的行处

javascript片段:

<script type="text/javascript">
    function processSigning(){
        var applet = document.applets["SignApplet"];
        var path_to_certificate = document.getElementById("certificate").value;
        var pass = document.getElementById("password").value;
        var filePath = document.getElementById("documentSign").value;
        applet.filePath = document.getElementById("documentSign").value;

        //at this line, call of method from applet, javascript stops, but applet has this method
        //and it's public
        applet.profileTestPKCS12(path_to_certificate, pass);

        document.getElementById("file").value = applet.getDocumentString(filePath);
        document.getElementById("sign").value = applet.getSignString();
        document.getElementById("cert").value = applet.getCertificateString();
        document.forms['mainForm'].submit();
//        document.getElementById("mainForm").submit();


    }
</script>

html 的小程序片段:

<APPLET name="SignApplet" mayscript code="SignApplet.class" archive="<%=renderResponse.encodeURL(renderRequest.getContextPath() + "/lib/SignApplet.jar")%>, <%=renderResponse.encodeURL(renderRequest.getContextPath() + "/lib/crypto.tsp.jar")%>, <%=renderResponse.encodeURL(renderRequest.getContextPath() + "/lib/crypto.gammaprov.jar")%>" height=500 width=500 style="display:none;">
    <PARAM name="boxmessage" value="Please wait, while applet is loading">
</APPLET>
4

2 回答 2

2
<APPLET name="SignApplet" ... style="display:none;">

W3C 关于“显示”属性

(value) none
此值导致元素不出现在格式化结构中(即,在视觉媒体中,元素不生成框并且对布局没有影响)。后代元素也不生成任何框;元素及其内容完全从格式化结构中删除。

于 2012-05-03T04:03:07.557 回答
2

在小程序中你应该避免使用 display:none ..... 当你定义为 none 时,在可视媒体中元素不生成框并且对布局没有影响....所以最好尝试visiblity:hidden属性而不是display:none ...

于 2012-05-03T04:19:13.730 回答