易截截图软件、单文件、免安装、纯绿色、仅160KB

javascript写的表格排序

/**
* 表格排序(单个表格,降序)
* @example
* <code>
* <table is_sort="1">
* <tr>
* <th><a href="javascript:void(0)" mce_href="javascript:void(0)" onclick="table_sort(0, 0)">field1</a></th>
* <th><a href="javascript:void(0)" mce_href="javascript:void(0)" onclick="table_sort(1, 1, 1)">field2</a></th>
* </tr>
*
* <!-- 此tr不会参与排序 -->
* <tr>
* <th>...</th>
* <td>...</td>
* </tr>
*
* <!-- 此tr参与排序 is_sort属性 sort_val属性 -->
* <tr is_sort="1">
* <th sort_val="val1">...</th>
* <th sort_val="val2">...</th>
* </tr>
* ...
* </table>
* </code>
* @param int index 需要排序的列(从0开始)
* @param int is_desc 是否降序
* @param int is_int 是否需要将排序值转换成int类型
* @return void
*/
function table_sort(index, is_desc, is_int)
{
$('table[is_sort=1]').each(function(){
var i=0, j=0, this_table = this, is_change=false, tr = null, tmp = null, sort_val1=0, sort_val2=0, pattern=/^0+/;
$('tr[is_sort=1]').each(function(){
j = 0;
tr = this;
$('tr[is_sort=1]', this_table).each(function(){
if (j>=i)
{
is_change = false;

//格式化排序值
sort_val1 = $($('th,td', tr).get(index)).attr('sort_val');
sort_val2 = $($('th,td', this).get(index)).attr('sort_val');

if (is_int)
{
if (sort_val1!='0')
{
sort_val1 = parseInt(sort_val1.replace(pattern, ''));
}
if (sort_val2!='0')
{
sort_val2 = parseInt(sort_val2.replac


相关文档:

JavaScript获取DOM节点元素

JavaScript获取DOM节点元素
在Web应用程序特别是Web2.0程序开发中,经常要获取页面中某个元素,然后更新该元素的样式、内容等。如何获取要更新的元素,是首先要解决的问题。令人欣慰的是,使用JavaScript获取节点的方法有很多种,这里简单做一下总结:
通过顶层document节点获取:
   1. document.getElement ......

ATL与JavaScript交互

原帖地址:http://www.followman.com/bbs/Topic-B11-T262.aspx
JavaScript动态响应ATL事件
相关讨论:http://topic.csdn.net/t/20061012/21/5078729.html

点:脚本传过来的对象是IDispatch接口,应该用IDispatch::Invoke来调用。如果传过来的是个function,那么DISPID
为0,如果是个对象,那么要先用GetIDsOfNames得 ......

用Javascript以类的方式进行冒泡排序

基本上全部加了注释,一行一注....呵呵
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>数组排序</title>
<mce:style type="text/css"&g ......

JavaScript Calls from C++

最近要用到相关技术,先贴在这,有空再翻页。
本文转自:
http://www.codeguru.com/Cpp/I-N/ieprogram/article.php/c4399
http://www.codeguru.com/cpp/i-n/ieprogram/article.php/c4399/JavaScript-Calls-from-C.htm
http://www.codeproject.com/KB/COM/jscalls.aspx

Introduction
Sometimes, when we are usi ......

javascript效率经验谈(一)

本文主要是出于有朋友使用我原来写的autocomplete的JS控件。当数据量大的时候,会出现效率极其慢的情况,我在这段时间做出的一些测试也及一些经验,与大家分享,如果有错的地方,还请指出。
经过测试,我们会发现如下的情况或者说的结论,如果您的测试结果与我的不符,请说明原因,以便相互学习。
1)当一个较大的HTML字� ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号