cells[index],children[index]效率问题

看到以下代码,并做了测试:

<body><input type=button onclick=hideCol(1) value='隐藏第 2 列'><input type=button onclick=showCol(1) value='显示第 2 列'><div id=tableBox></div><script>//--------------------------------------------------------// 时间转为时间戳(毫秒)function time2stamp(){var d=new Date();return Date.parse(d)+d.getMilliseconds();} //--------------------------------------------------------// 创建表格function createTable(rowsLen){    var str = "<table border=1>" +                "<thead>" +                     "<tr>" +                        "<th width=100>col1<\/th>" +                        "<th width=200>col2<\/th>" +                         "<th width=50>col3<\/th>" +                     "<\/tr>" +                "<\/thead>" +                "<tbody>";    var arr = [];    for (var i=0; i<rowsLen; i++)    {        arr[i] = "<tr><td>" + i + "1<\/td><td>" + i + "2</td><td>" + i + "3<\/td></tr>";    }    str += arr.join("") + "</tbody><\/table>"; // 用 join() 方式快速构建字串,速度极快    tableBox.innerHTML = str; // 生成 table}//--------------------------------------------------------// 隐藏/显示指定列function hideCol(colIdx){hideOrShowCol(colIdx, 0);}function showCol(colIdx){hideOrShowCol(colIdx, 1);}// - - - - - - - - - - - - - - - - - - - - - - - - - - - -function hideOrShowCol(colIdx, isShow){    var t1 = time2stamp(); //     var table = tableBox.children[0];    var rowsLen = table.rows.length;    var lastTr = table.rows[0];    for (var i=0; i<rowsLen; i++)    {        var tr = table.rows[i];        tr.children[colIdx].style.display = isShow ? "" : "none";    }    var t2 = time2stamp();    alert("耗时:" + (t2 - t1) + " 毫秒");}//--------------------------------------------------------createTable(1000); // 创建千行表格</script>

以上是小编为您精心准备的的内容,在的博客、问答、公众号、人物、课程等栏目也有的相关内容,欢迎继续使用右上角搜索按钮进行搜索date
, createtable
, function
, index
, 时间
, var
getMilliseconds
wpf children zindex、indexof效率、js indexof效率、java indexof效率、c indexof效率,以便于您获取更多的相关知识。

时间: 2024-08-09 13:22:03

cells[index],children[index]效率问题的相关文章

Sql Server中的表访问方式Table Scan, Index Scan, Index Seek

  Sql Server中的表访问方式Table Scan, Index Scan, Index Seek 0.参考文献 oracle表访问方式 Index Seek和Index Scan的区别以及适用情况 1.oracle中的表访问方式 在oracle中有表访问方式的说法,访问表中的数据主要通过三种方式进行访问: 全表扫描(full table scan),直接访问数据页,查找满足条件的数据 通过rowid扫描(table access by rowid),如果知道数据的rowid,那么直接通

Lucene in action 笔记 index篇

一. Index之前要做什么 1. 将要index的内容转化为文本 你要处理的文件可能是PDF, word, html, OK通通转化成文本, lucene只能处理文本 2.分析文本 在index之前, 必须对文本做一系列的分析, 对文本的token化, 就是分词. 然后滤掉一些没有区分度的词, 如stop word 这个地方涉及语言相关性. 不同语言的处理会不同. 英文还要处理大小写, 派生词. 这一步对于index非常重要, 所以在lucene中选取和开发合适的analysizor是关键的一

MYSQL中的type:index 和 Extra:Using index

原创水平有限,如有错误请指出 考虑下面执行计划中的TYPE和Extra +----+-------------+--------+------------+-------+---------------+------+---------+------+------+----------+-------------+ | id | select_type | table  | partitions | type  | possible_keys | key  | key_len | ref  |

如何让Apache能自动运行index.php?

apache 编辑httpd.conf文件,找到DirectoryIndex在后面加一个index.php.例如,我把DirectoryIndex这行改为:DirectoryIndex index.html index.htm index.php index.html.var 保存编辑的内容,重新启动Apache就可以实现了.

默认首页index/default做301重定向的思考

笔者的SEO博客没有使用301重定向,主要是虚拟主机不支持,也罢.之前谈到URL标准化的5条建议也略有提到,但忽略了一种情况. 一般情况下,我们在搜索结果页面看到的都是省去默认首页的,主流建站程序语言有asp/php/jsp/.net,其默认首页一般是index.html/index.htm/index.php/index.asp/default.asp/default.aspx等.推荐阅读:做网站哪种编程语言好.比如WordPress默认首页应该是这样调用的,当有人输入http://www.×

Oracle技术:使用Index提示强制使用索引

虽然索引并不总会快于全表扫描,但是很多时候我们希望Oracle使用索引来执行某些SQL,这时候我们可以通过index hints来强制SQL使用index. Index Hints的格式如下: /*+ INDEX ( table [index [index]...] ) */我们简单看一下这个提示的用法(范例为Oracle10g数据库): SQL> create table t as select username,password from dba_users;Table created.SQ

修改apache配置文件去除thinkphp url中的index.php

 这篇文章主要介绍了修改apache配置文件去除thinkphp url中的index.php的方法,大家参考使用吧 例如你的原路径是 http://localhost/test/index.php/index/add 那么现在的地址是 http://localhost/test/index/add 如何去掉index.php呢?   1.httpd.conf配置文件中加载了mod_rewrite.so模块  //在APACHE里面去配置   代码如下: #LoadModule rewrite_

怎么去掉织梦网站里面的index.html

中介交易 http://www.aliyun.com/zixun/aggregation/6858.html">SEO诊断 淘宝客 云主机 技术大厅 最近有好些站长朋友反映他们用织梦系统搭建的网站打开网站域名老是跳转到index.html问我有没有办法去掉. 要解决这个问题首先我得搞清楚这个问题是怎么引起的,其实这个问题的出现是因为根目录下面的index.php,我们截取index.php从第14行到38行代码 if(isset($_GET['upcache']) || !file_exi

c#-C#listview 返回items.index

问题描述 C#listview 返回items.index 为什么listview无论点哪行items.index都返回0 private void Hide_ToolStripMenuItem_Click(object sender, EventArgs e) { //隐藏数据 if (MessageBox.Show("是否隐藏本条数据?", "提问", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == Di