2012年1月17日星期二

placeholder

HTML5 placeholder jQuery Plugin

HTML5 Placeholder jQuery Plugin

Check out the HTML5 Placeholder jQuery Plugin project page on GitHub.

$(function() {
$('input, textarea').placeholder();
});

Mathias

多线程测试

JUNIT 不支持多线程
http://groboutils.sourceforge.net/

import java.util.ArrayList;
import java.util.List;
import java.util.Random;


import net.sourceforge.groboutils.junit.v1.MultiThreadedTestRunner;
import net.sourceforge.groboutils.junit.v1.TestRunnable;


import org.junit.Test; 

class TestRunnableImpl extends TestRunnable{ 
@Override
public void runTest() throws Throwable {
//do something
}

}
public class MutilThreadTest { 
@Test
public void transaction() throws Throwable{ 
  List<TestRunnable> list = new ArrayList<TestRunnable>();
for (int i = 0; i < 50; i++) {
list.add(new TestRunnableImpl(ctx));
}
TestRunnable[] empty = new TestRunnable[0];
MultiThreadedTestRunner mttr = new MultiThreadedTestRunner( list.toArray(empty) );
                mttr.runTestRunnables( 2 * 60 * 1000 );

}

2012年1月16日星期一

checkbox全选的设计

http://viralpatel.net/blogs/2010/11/multiple-checkbox-select-deselect-jquery-tutorial-example.html


<SCRIPT language="javascript">
$(function(){
 
    // add multiple select / deselect functionality
    $("#selectall").click(function () {
          $('.case').attr('checked', this.checked);
    });
 
    // if all checkbox are selected, check the selectall checkbox
    // and viceversa
    $(".case").click(function(){
 
        if($(".case").length == $(".case:checked").length) {
            $("#selectall").attr("checked", "checked");
        } else {
            $("#selectall").removeAttr("checked");
        }
 
    });
});
</SCRIPT>