易截截图软件、单文件、免安装、纯绿色、仅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获取显示器尺寸

以下事例为结合本人电脑而设计的参数,您也可改为自己的尺寸
<SCRIPT LANGUAGE="JavaScript">
var chicun;
chicun=screen.width;
if(chicun==1280||chicun==1440||chicun==1600)
{
<!--
function initEcAd() {
document.all.AdLayer1.style.posTop = -100;
document.all.AdLayer1.style.visibility = 'vis ......

用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 中call与apply区别

1.call方法
官方(JavaScript手册):
调用一个对象的一个方法,以另一个对象替换当前对象。
call([thisObj[,arg1[,
arg2[,   [,.argN]]]]])
参数
thisObj  可选项。将被用作当前对象的对象。
arg1, arg2,  , argN
可选项。将被传递方法参数序列。
  
说明
call 方法可以用来代 ......

JavaScript 时间加减 改变

JavaScript 时间加减:
<HTML>
<BODY>
    <script type="text/javascript">
        var time = new Date("04/30/2010");
        document.write(time);
        ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号