js中动态更改事件(如onFocus后改为onclick)

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!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 runat="server">
    <title>Untitled Page</title>
    <script language=javascript>
function _001(obj,xx1,xx2,xx3)
{
        alert("focusValue="+obj.id+"|"+xx1+"|"+xx2+"|"+xx3)
        obj.onfocus=null
        obj.onclick=function()
        {
                _002(obj,xx1,xx2,xx3)
        }
}
function _002(obj,yy1,yy2,yy3)
{
        alert("clickValue="+obj.id+"|"+yy1+"|"+yy2+"|"+yy3)
}
</script>


</head>
<body>
    <form id="form1" runat="server">
    <div>
   <input id="txt" type="text" name="t_xt" onfocus="_001(this,1,2,3);">
    </div>
    </form>
</body>
</html>

你可能感兴趣的:(onclick)