网页中select控件数据量大时,客户端操作技巧!
来源:互联网 发布:如何学软件编程 编辑:程序博客网 时间:2024/06/05 19:44
当select控件数据量有上千个选项时,你动态添使用JS添加option生成是很慢的可能要等上5秒甚至几十秒时间!用户会认为死机!
解决:不用JS的option添加。
IE用outerHTML组合成,其他浏览器用innerHTML组合成。如下:
function selchange() {
var odep = document.getElementById("ListBox_Dept");
if (odep.selectedIndex >= 0) {
var strdep = odep.options[odep.selectedIndex].text;
var strallusers = document.getElementById("TextBox_allusers").value;
var users = strallusers.split(";");
var osel = document.getElementById("ListBox_src")
var k = [], k1 = []; //k-IE浏览器内容 , k1-其他浏览器内容
k.push("<select size='4' name='ListBox_src' id='ListBox_src' style='height:160px;width:128px;'>");
if (strdep != "全部") {
for (var i = 0; i < users.length-1; i++) {
var ouser = users[i].split(",");
var strusernum = ouser[0];
var strusername = ouser[1];
var struserdept = ouser[2];
if (strdep == struserdept) {
k.push("<option value='" + strusernum + "'>" + strusername + "</option>");
k1.push("<option value='" + strusernum + "'>" + strusername + "</option>");
}
}
}
else {
for (var i = 0; i < users.length-1; i++) {
var ouser = users[i].split(",");
var strusernum = ouser[0];
var strusername = ouser[1];
var struserdept = ouser[2];
k.push("<option value='" + strusernum + "'>" + strusername + "</option>");
k1.push("<option value='" + strusernum + "'>" + strusername + "</option>");
}
}
k.push("</select>");
if (document.all) {
osel.outerHTML = k.join("");
}
else {
osel.innerHTML = k1.join("");
}
}
}
- 网页中select控件数据量大时,客户端操作技巧!
- select 大数据量append
- 大数据量数据管理技巧
- 大数据量delete操作
- C# 使用serialport 控件读写串口的大数据量解决方案 -- 以及与串口操作中常见的错误
- 编程技巧:动态操作网页控件
- oracle中大数据量join操作的试验
- oracle 中 对大数据量 字段进行update操作
- Orace中大数据量的DML操作事务的优化
- 数据库大数据量的操作
- Hibernate大数据量操作解决方案
- Hibernate大数据量操作解决方案
- Hibernate进行大数据量处理时的优化操作
- 大数据量查询的优化技巧
- 大数据量的数据库表设计技巧
- 大数据量文件的上传下载技巧
- mysql大数据量分页查询优化技巧
- 【优化】大数据量内表优化技巧
- Linux C 编程内存泄露检测工具(一):mtrace
- MikeOS
- eclipse生成boolean型变量的getter是is开头
- 使用 Tkprof 分析 ORACLE 跟踪文件
- 报错:1130-host ... is not allowed to connect to this MySql server
- 网页中select控件数据量大时,客户端操作技巧!
- 最大类间方差法(大津法,OTSU)
- 安装APK安装包
- Spring注解
- 基于CRF的中文分词
- UDP编程中的connect
- Mediator Pattern - Multithread Application (中介者模式 - 解析例子)
- 数据适配器简介(Adapter)
- android联系人重名,导致共用contactId的解决办法