Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/81.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript e) );您还可以尝试$(selectorText).each(函数(){this.checked=false});没有保证,但可能值得一试。我想过要这么做。我试试看会发生什么。实际上,我们在150秒之前发出了一个“请稍候”的通知,但将其降到2-3将是非常_Javascript_Jquery_Performance - Fatal编程技术网

Javascript e) );您还可以尝试$(selectorText).each(函数(){this.checked=false});没有保证,但可能值得一试。我想过要这么做。我试试看会发生什么。实际上,我们在150秒之前发出了一个“请稍候”的通知,但将其降到2-3将是非常

Javascript e) );您还可以尝试$(selectorText).each(函数(){this.checked=false});没有保证,但可能值得一试。我想过要这么做。我试试看会发生什么。实际上,我们在150秒之前发出了一个“请稍候”的通知,但将其降到2-3将是非常,javascript,jquery,performance,Javascript,Jquery,Performance,e) );您还可以尝试$(selectorText).each(函数(){this.checked=false});没有保证,但可能值得一试。我想过要这么做。我试试看会发生什么。实际上,我们在150秒之前发出了一个“请稍候”的通知,但将其降到2-3将是非常好的。更多的选择条件不会加快查询速度,除非每个选择条件都减小了设置的大小。因为所有的复选框都在表行中,并且都有输入,所以将它们作为标准添加是没有帮助的。“我想,既然我发布了更多的过滤器,它会更快。”正如Zan所说,更多的过滤器=更多的检查=更多


e) );您还可以尝试$(selectorText).each(函数(){this.checked=false});没有保证,但可能值得一试。我想过要这么做。我试试看会发生什么。实际上,我们在150秒之前发出了一个“请稍候”的通知,但将其降到2-3将是非常好的。更多的选择条件不会加快查询速度,除非每个选择条件都减小了设置的大小。因为所有的复选框都在表行中,并且都有输入,所以将它们作为标准添加是没有帮助的。“我想,既然我发布了更多的过滤器,它会更快。”正如Zan所说,更多的过滤器=更多的检查=更多的处理=更多的时间。除非每个过滤器显著减少下一个过滤器的设置大小,否则它只会占用周期。等等……阅读全文,看起来我可能提供了错误的上下文??尽管如此,还是值得一试。看起来2.45-6秒可能是你能达到的最快速度。现在看来:)实际上比他们使用javascript方法之前要好。使用这两个选择器,它将选中所有复选框,而不仅仅是第二列。我想,到底是什么原因,我也会尝试一下。又很有趣!
<form id="form1" runat="server">
    <div>
        <a href="#" id="one">input[id^='chkbox'][type='checkbox']</a><br />
        <a href="#" id="two">#myTable tr[id^='row'] input[id^='chkbox'][type='checkbox']</a><br />
        <a href="#" id="three">#myTable tr.myRow input[id^='chkbox'][type='checkbox']</a><br />
        <a href="#" id="four">tr.myRow input[id^='chkbox'][type='checkbox']</a><br />
        <a href="#" id="five">input[id^='chkbox']</a><br />
        <a href="#" id="six">.chkbox</a><br />
        <a href="#" id="seven">input.chkbox</a><br />
        <a href="#" id="eight">#myTable input.chkbox</a><br />

        <a href="#" id="nine">"input.chkbox", "tr"</a><br />
        <a href="#" id="nine1">"input.chkbox", "tr.myRow"</a><br />
        <a href="#" id="nine2">"input.chkbox", "#form1"</a><br />
        <a href="#" id="nine3">"input.chkbox", "#myTable"</a><br />

        <a href="#" id="ten">input[name=chkbox]</a><br />
        <a href="#" id="ten1">"input[name=chkbox]", "tr.myRow"</a><br />
        <a href="#" id="ten2">"input[name=chkbox]", "#form1"</a><br />
        <a href="#" id="ten3">"input[name=chkbox]", "#myTable"</a><br />

        <a href="#" id="ten4">"input[name=chkbox]", $("#form1")</a><br />
        <a href="#" id="ten5">"input[name=chkbox]", $("#myTable")</a><br />

        <a href="#" id="eleven">input[name='chkbox']:checkbox</a><br />
        <a href="#" id="twelve">:checkbox</a><br />
        <a href="#" id="twelve1">input:checkbox</a><br />
        <a href="#" id="thirteen">input[type=checkbox]</a><br />

        <div>
            <input type="text" id="goBox" /> <button id="go">Go!</button>
            <div id="goBoxTook"></div>
        </div>

        <table id="myTable">
            <tr id="headerRow"><th>Row #</th><th>Checkboxes o' fun!</th><th>Don't check these!</th></tr>
            <% for(int i = 0; i < 20000;i++) { %>
            <tr id="row<%= i %>" class="myRow">
                <td><%= i %> Row</td>
                <td>
                    <input type="checkbox" id="chkbox<%= i %>" name="chkbox" class="chkbox" />
                </td>
                <td>
                    <input type="checkbox" id="otherBox<%= i %>" name="otherBox" class="otherBox" />
                </td>
            </tr>
            <% } %>
        </table>
    </div>

    <script type="text/javascript" src="<%= ResolveUrl(" ~/") %>Javascript/jquery.1.3.1.min.js"></script>
    <script type="text/javascript">

        $(function () {
            function run(selectorText, el) {
                var start = new Date();
                $(selectorText).attr("checked", true);
                var end = new Date();
                var timeElapsed = end - start;
                $(el).after("<br />Checking Took " + timeElapsed + "ms");

                start = new Date();
                $(selectorText).attr("checked", false);
                end = new Date();
                timeElapsed = end - start;
                $(el).after("<br />Unchecking Took " + timeElapsed + "ms");
            }

            function runWithContext(selectorText, context, el) {
                var start = new Date();
                $(selectorText, context).attr("checked", true);
                var end = new Date();
                var timeElapsed = end - start;
                $(el).after("<br />Checking Took " + timeElapsed + "ms");

                start = new Date();
                $(selectorText, context).attr("checked", false);
                end = new Date();
                timeElapsed = end - start;
                $(el).after("<br />Unchecking Took " + timeElapsed + "ms");
            }

            $("#one").click(function () {
                run("input[id^='chkbox'][type='checkbox']", this);
            });

            $("#two").click(function () {
                run("#myTable tr[id^='row'] input[id^='chkbox'][type='checkbox']", this);
            });

            $("#three").click(function () {
                run("#myTable tr.myRow input[id^='chkbox'][type='checkbox']", this);
            });

            $("#four").click(function () {
                run("tr.myRow input[id^='chkbox'][type='checkbox']", this);
            });

            $("#five").click(function () {
                run("input[id^='chkbox']", this);
            });

            $("#six").click(function () {
                run(".chkbox", this);
            });

            $("#seven").click(function () {
                run("input.chkbox", this);
            });

            $("#eight").click(function () {
                run("#myTable input.chkbox", this);
            });

            $("#nine").click(function () {
                runWithContext("input.chkbox", "tr", this);
            });


            $("#nine1").click(function () {
                runWithContext("input.chkbox", "tr.myRow", this);
            });
            $("#nine2").click(function () {
                runWithContext("input.chkbox", "#form1", this);
            });
            $("#nine3").click(function () {
                runWithContext("input.chkbox", "#myTable", this);
            });

            $("#ten").click(function () {
                run("input[name=chkbox]", this);
            });

            $("#ten1").click(function () {
                runWithContext("input[name=chkbox]", "tr.myRow", this);
            });

            $("#ten2").click(function () {
                runWithContext("input[name=chkbox]", "#form1", this);
            });

            $("#ten3").click(function () {
                runWithContext("input[name=chkbox]", "#myTable", this);
            });

            $("#ten4").click(function () {
                runWithContext("input[name=chkbox]", $("#form1"), this);
            });

            $("#ten5").click(function () {
                runWithContext("input[name=chkbox]", $("#myTable"), this);
            });

            $("#eleven").click(function () {
                run("input[name='chkbox']:checkbox", this);
            });

            $("#twelve").click(function () {
                run(":checkbox", this);
            });

            $("#twelve1").click(function () {
                run("input:checkbox", this);
            });

            $("#thirteen").click(function () {
                run("input[type=checkbox]", this);
            });

            $('#go').click(function () {
                run($('#goBox').val(), this);
            });
        });
    </script>
</form>
Unchecking Took 2453ms
Checking Took 2438ms
Unchecking Took 2438ms
Checking Took 2437ms
Unchecking Took 2453ms
Checking Took 2438ms
Unchecking Took 2813ms
Checking Took 2797ms
Unchecking Took 2797ms
Checking Took 2797ms
Unchecking Took 2813ms
Checking Took 2797ms
Unchecking Took 2797ms
Checking Took 2797ms
Unchecking Took 2813ms
Checking Took 2781ms
Unchecking Took 4031ms
Checking Took 4062ms
Unchecking Took 4031ms
Checking Took 4062ms
Checking Took 149797ms
Unchecking Took 3031ms
Checking Took 3016ms
Unchecking Took 3375ms
Checking Took 3344ms
Checking Took 10422ms
Checking Took 8546ms
Checking Took 8875ms
Unchecking Took 3032ms
Checking Took 3000ms
Unchecking Took 2906ms
Checking Took 2875ms
Unchecking Took 2469ms
Checking Took 2453ms
Checking Took 9547ms
Unchecking Took 3140ms
Checking Took 3141ms
Unchecking Took 2985ms
Checking Took 2969ms
Unchecking Took 3078ms
Checking Took 3000ms
Unchecking Took 3078ms
Checking Took 3016ms
Unchecking Took 2938ms
Checking Took 2906ms
Unchecking Took 2938ms
Checking Took 2921ms
Unchecking Took 8328ms
Checking Took 6250ms
Unchecking Took 5016ms
Checking Took 5000ms
Unchecking Took 4969ms
Checking Took 4938ms
$("input[id^='chkbox']")
$("input[id^='chkbox']", "#myFormID")
$(':checkbox')
$('input[type=checkbox]')