日期:2014-05-16 浏览次数:20336 次
$("#prebt").unbind("onclick",function(){var p= $("#nextbt").parent();$("#nextbt").remove(); p.append("<input id=\"nextbt\" type=\"button\" value=\"编辑\" onclick=\"ToPage(14)\"/>")});
$("#prebt").removeAttr("onclick"); $("#prebt").attr("onclick","ToPage(4)"); 或者: $("#prebt").attr("onclick",""); $("#prebt").attr("onclick","ToPage(4)");
$("#prebt").removeAttr("onclick"); $("#prebt").click(function(){ToPage(4)}); //此句会导致死循环..不知怎么回事.. //我做的分页功能...这样写导致数据一直在乱跳...
<!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> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>无标题文档</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script> <script type="text/javascript"> //<![CDATA[ function toPage(id){alert(id);} $(function(){ $('#btndemo').removeAttr('onclick').unbind('click').click(function(){ toPage(1); }) }) //]]> </script> </head> <body> <input id="btndemo" type="button" value="click" onclick="toPage(4)" /> </body> </html>