如何处理IE6中具有数千个复选框的页面上的javascript [英] How to handle javascript on page with thousands of checkboxes in IE6

查看:60
本文介绍了如何处理IE6中具有数千个复选框的页面上的javascript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在用某些JavaScript用ASP.NET编写的代码中遇到了问题,将发回服务器的内容更改为大约8,000个复选框的网格.这就是我测试的时候,IE6大约有1,000个复选框,一切似乎都还不错.但是现在,导入了真实数据后,我对IE6的运行速度感到困惑,而且我写的代码不会减少它的现实.

I am having problems with code written in ASP.NET with some javascript, doing a postback to the server for changes made to a grid of approximately 8,000 checkboxes. The this is, while I was testing it, everything seemed ok with approximately 1,000 checkboxes with IE6. But now, having imported the real data, I am stuck with the slowness of IE6 and the reality that the code I wrote is not going to cut it.

我必须使用IE6进行测试,因为不幸的是,客户端要求Web应用程序具有完整的功能.如何提高页面速度?

I have to use IE6 to test it because unfortunately, the client demands the web app to be fully functional with it. How can I boost speed of the page?

编辑

我计算了行数和列数:页面上的66 * 110 = 7260复选框.

I counted the rows and colums: 66 * 110 = 7260 checkboxes on the page.

代码

[...]

<asp:Repeater ID="repChkAssociations" runat="server" DataSource="<%#Failures%>">
<ItemTemplate>
    <td style="text-align: center;">
        <asp:CheckBox ID="cbEqClassFailure" runat="server" Enabled="<%#AllowEditAssociations%>"
            ToolTip='ommited code'
            Checked='ommited code'
            OnClick="setIsDirty(true);"
            >
        </asp:CheckBox>
    </td>
</ItemTemplate>

[...]

<script src="~/Scripts/jquery-1.6.1.min.js"></script>

<script type="text/javascript">

    var isDirty;
    var identifiter;

    function SaveAssociation() {
        setIsDirty(false);
    }

    // check if the page has been modified
    function CheckIsDirty(_id) {
        setID(_id);
        if (getIsDirty() == true) {
            ShowConfirmPopup();
        } else {
            ShowGridPopup(); 
        }
    }

    function ShowGridPopup() {
        if (getID() == "EqClasses") {
            ShowClassPopup();
        } else if (getID() == "Failures") {
            ShowFailurePopup();
        }
    }

    // isDirty setter        
    function setIsDirty(changeVal) {
        isDirty = changeVal;
    }

    // isDirty getter
    function getIsDirty() {
        return isDirty;
    }

function ClickSaveButton() {
    var _id = $('a[id$="butSaveAssociation"]').attr("ID");
    __doPostBack(_id.replace("_", "$"), '');
}

function ShowClassPopup() {
    var _id = '<%= eqClassPopup.BehaviorID %>';
    var modal = $find(_id);
    modal.show();
}

function ShowFailurePopup() {
    var _id = '<%= failurePopup.BehaviorID %>';
    var modal = $find(_id);
    modal.show();
}

function ShowConfirmPopup() {
    var _id = '<%= confirmPopup.BehaviorID %>';
    var modal = $find(_id);
    modal.show();
}
</script>

推荐答案

很高兴,我不知道您在做什么,但是一页上有8,000个复选框对我来说似乎非常不友好.考虑添加分页&进行过滤以使每页复选框的数量保持在100个以下?

Granted, I don't know what you're doing, but having 8,000 check boxes on one page seems pretty user-unfriendly to me. Consider adding pagination & filtering to keep the number of check boxes per page under, perhaps, 100?

编辑-您似乎也认为这是IE6问题.我可能会猜测,任何浏览器都会干扰您正在谈论的音量.

EDIT - You also seem to think this is an IE6 problem. I'd hazard a guess that any browser would have troubles with the volume you're talking.

双重编辑-好的,查看完您的代码后,我确定提高速度的唯一方法是减少网站上的控件数量.您没有在JS中做任何疯狂的事情.

DOUBLE EDIT - Okay, after looking over your code, I'm certain the only way to improve speed is to reduce the number of controls on the website. You're not doing anything crazy in the JS.

这篇关于如何处理IE6中具有数千个复选框的页面上的javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆