Skip to content

Instantly share code, notes, and snippets.

@fordlee404
Created November 18, 2013 05:38
Show Gist options
  • Save fordlee404/7523050 to your computer and use it in GitHub Desktop.
Save fordlee404/7523050 to your computer and use it in GitHub Desktop.
创建一次性事件
document.getElementById("myelement").addEventListener("click", handler);
// 处理器函数
function handler(e) {
// 移除处理器
e.target.removeEventListener(e.type, arguments.callee);
alert("You'll only see this once!");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment