4

コードの実行で次のエラーが発生します 。MicrosoftJScriptランタイムエラー:エラー80020101のため、操作を完了できませんでした。

次のリンクは、Stackoverflowで見つけたものです: Ajaxリクエストの問題:エラー80020101

var div = $("<div class='modal'>").html($(result.getWebFormDesignFieldContentsResult));

渡された情報result.getWebFormDesignFieldContentsResultは、まだDOMに解析されていないHTMLとJAVASCRIPTの長い文字列です。先日動作させていたので、機能を追加しようとしていたので、奇妙だと思いました。:(

渡される文字列はかなり大きいですが、次のようなものです。

<div>input tags for filtering</div>
<select><option></option>...[150 option tags]... </select>
<anchor tag to return contents>
<script type = "text/javascript">
  ...stuff fires related to the above items...
</script>

スクリプトタグとは異なる可能性があるため、divタグに文字列として渡された情報を取得する際に問題が発生していると考えていました。

他の誰かがこれを達成しましたか、またはこれを処理する方法について私にいくつかの指針を与えるために何を教えてください?文字列オブジェクトを作成し、それに応じてコンテンツを分割し、htmlのみをhtmlに配置してから、jsを別のスタイルで処理したい場合があります。

結果文字列(result.getWebFormDesignFieldContentsResult)

こちらからもアクセスできます:http: //jsfiddle.net/3kFv2/

            <table style='width:inherit;'>
                <tr>
                    <td>
                        <input type='text' id ='queryInput' onkeypress = 'clearTimeout(timerVar); timerVar = setTimeout(function(){ fetchFieldInfo($("#queryInput").val()); },1000);' />
                    </td>
                    <td style = 'text-align:right;'>
                        <a class = 'modalButton' id = 'queryButton' runat='server' value = 'Re-Filter' onCLick = '$("div.modal").fadeOut(); fetchFieldInfo($("#queryInput").val());'>Re-Filter</a>
                    </td>
                </tr>
                <tr>
                    <td colspan='2' style='margin-left:auto; margin-right:auto; text-align:center;'><select size = '20' id = 'selectList' name = 'selectList' ><option value = '1000'>Abutment Notes</option><option value = '2300'>Abutments Notes</option><option value = '2302'>Abutments Notes Maint Need</option><option value = '2301'>Abutments Notes Remarks</option><option value = '10942'>Concrete Deterioration Maint Need</option></select></td>
                <td>
                    <div style='width:300px;height:300px;' id = 'modalInfoPanel'>
                    </div>
                </td>
            </tr>
            <tr>
                <td></td>
                <td style='text-align:right;'>
                    <a class = 'modalButton' id = 'buttonReturnValue' value = 'Return Selected Element' onClick='$("div.modal, div.overlay").fadeOut();'>Return Selected Element</a>
                </td>
            </tr>
        </table>
        <script type = 'text/javascript'>
            function ajaxDisplayContents(value){
                //alert(value.val());
 /*
                $('#selectList option').each(function(){
                    return $(this).val() == '';
                }).attr('selected','selected');
 */
                $.ajax({
                    type: 'POST',
                    url: WEBSERVICE_URL + '/fetchFieldInfo',
                    dataType: 'json',
                    contentType: 'application/json',
                    data: JSON.stringify({'fe_id': value.val().toString()}),
                    success: function(result, textStatus, jqXHR){
                        $('#modalInfoPanel').html(result.fetchFieldInfoResult);
                    },
                    error: function(xhr, status, message){
                        $('#modalInfoPanel').html(status + ' ' + message);
                    }
                });
            }
            $('select#selectList').change(function(){
                ajaxDisplayContents($(this));
            });


            $(function(){
                $('ul li').click(function(){ clicker(this); });
            });
            function clicker(x){
                if($(x).next().is('li') || $(x).next().length == 0){
                    $.ajax({
                        type: 'POST',
                        url:,
                        dataType: 'json',
                        contentType: 'application/json',
                        data: JSON.stringify({}),
                        success: function(result){
                            $(x).after($('<ul>').append($(result['METHODResult']));
                            $(x).next().find('li').click(function() clicker(this); });
                        },
                        error: function(){
                            alert('failed to fetch');
                        }
                    });
                }else if($(x).next().is('ul')){
                    $(x).next().slideUp(function(){ $(this).remove(); });
                }
            }
        </script>
4

3 に答える 3

4

同じエラー80020101が発生しました。

次に、コードを1行ずつ確認しているときに、誤ってこれを2回追加したことに気付きました。<script<script>

これらを削除すると、エラーはなくなりました。

したがって、特に適切に閉じられていないタグを開く場合は、すべてのコードを再確認してください。

于 2012-11-30T13:28:37.810 に答える
3

http://mattwhite.me/blog/2010/4/21/tracking-down-error-80020101-in-internet-exploder.htmlを見ると 、埋め込まれたスクリプトタグなどのエラーが発生していることがわかります。 ..ルートでは、エラーは単に「エラーがあります」と述べているだけです。

その情報を心に留めた後、私は自分のコードを掘り下げて、あちこちにコメントを付けて、ますます多くの問題を見つけました。私が問題で見つけたエラーは、clicker()ajax呼び出しでした。私はそれを一瞬見て、元のajax呼び出しがコメントアウトされていることに気づきました。これは、実装されていないWebサービスへの新しい呼び出しであり、エラーがあります。私はそれをコメントアウトしたので、それは再び通常のように機能します、私はそのajax呼び出しのためにすべてを正しく定義する必要があります、そしてすべてがうまくいくでしょう。

デバッグを手伝ってくれた皆さんに感謝します。:)

于 2012-07-17T17:02:21.323 に答える
0

私の場合、問題はいくつかのコメント行の最後にある特殊文字(アクセント)でした。

これらの文字がコメント行の終わりに近づくと、Internet Explorerはそれらの一部(改行文字を含む)を削除し、JavaScriptコードを壊します。

// This comment line could fail because it has an accent at the end aeíou
alert("This line probably doesn't work in IE");

IEは、この行を次のように理解します。

// This comment line could fail because it has an accent at the end **aealert**("This line probably doesn't work in IE");

お役に立てば幸いです。

于 2015-04-22T07:44:45.253 に答える