Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
887 views
in Technique[技术] by (71.8m points)

jquery - jQueryUI Dialog + Firefox + ASP.Net = access to strict mode caller function is censored

I have a page that works great in IE and Chrome, but doesn't work in Firefox and Opera. When I say it doesn't work I mean that the Submit button doesn't do anything at all. It is a page with several nested UpdatePanels on it and a couple of jQueryUI Accordions on it too.

I have a simple div.

<div id="date-dialog" title="Date?">
    <label id="lblDate" for="txtDate">
        Please Enter Your The Date:
    </label>
    <input type="text" id="txtDate" class="text ui-widget-content ui-corner-all" />
</div>

And then I have some simple code to turn it into a dialog:

$('#date-dialog').dialog({
    autoOpen: false,
    modal: true,
    resizable: false,
    buttons: {
        "Submit": function () {
            __doPostBack('DateButton', $('#txtDate').val());
        },
        "Cancel": function () {
            $(this).dialog("close");
        }
    }
});

$('#txtDate').datepicker({ dateFormat: 'yy-mm-dd' });

I've also tried adding this, which doesn't help and which actually doesn't work with a modal dialog:

    open: function (type, data) {
        $(this).parent().appendTo("form");
    },

In Firefox I get the following error:

Error: TypeError: access to strict mode caller function is censored
Source File: http://ajax.microsoft.com/ajax/4.0/2/MicrosoftAjaxWebForms.debug.js
Line: 718

I have no idea what to do to fix this. I would love to turn off strict mode, but I can't find any information on how to do that. I can barely find any information about that error using Google. It seems like what I'm doing should be quite simple.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

This is kind of an old post, but this issue still occurred to me today. I didn't wanted to use the click of the button, so instead i tried a setTimeout and it also works.

To people having this issue, try this solution:

setTimeout(function() { __doPostBack('DateButton', $('#txtDate').val()); }, 1);

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...