<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>
<BODY>
<mce:script language="javascript" src="jquery-1.5.js" mce_src="jquery-1.5.js" ></mce:script>
<mce:script language="javascript" ><!--
var i = 0;
var ii = 0;
$(document).ready(function(){
/** 绑定只执行一次的自定义事件 **/
$("#testUl").one('testOne',function(){
i++;
alert("i="+i);
});
/** 绑定自定义事件 **/
$("#testUl").bind("testBind",function(){
ii++;
alert("ii="+ii);
});
});
/** 事件触发 **/
function testOne()
{
$("#testUl").trigger("testOne");
}
function testBind()
{
$("#testUl").trigger("testBind");
}
<input type="button" onclick="testOne()" value="testOne" />
<input type="button" onclick="testBind()" value="testBind" />
</BODY>
</HTML>