$("#sava").removeAttr("onClick");
$("#sava").unbind( "click" )
$("#cu_save").click( function() {
alert("OOOO");
});<input type="button" value="新增" id="save" name="cu_save" class="anniu_1" onClick="toAdd();" />我用了两种方法了还是不能清除,还是进入了toAdd()方法
可能是什么原因呢?????
$("#sava").unbind( "click" )
$("#cu_save").click( function() {
alert("OOOO");
});<input type="button" value="新增" id="save" name="cu_save" class="anniu_1" onClick="toAdd();" />我用了两种方法了还是不能清除,还是进入了toAdd()方法
可能是什么原因呢?????
解决方案 »
- 弹出一个aspx页面,不要窗口的边框,像个div层那样的
- 关于onbeforeunload的问题,可能有点难,不知道是不是无解
- js时间倒计
- 在javascript中如何处理中文参数?100分
- 问个javascript的问题~window.location定时跳转的问题!
- javascript 如何定义集合
- 请问:如何用javascript取的C:\my document\doc\docname.doc字符串中的文件名称!
- 老同志碰到新问题,求高手指点
- 请教:根据选项按纽的选择不一样,文本框是否可见!
- 如何取得<iframe id="message">></iframe>
- 一个页面显示特效,求教!
- 当文字达到限制限制省略号并且自动收缩 还有可以点击展开的代码~
$("#sava").unbind( "click" )$("#save").removeAttr("onclick");
$("#save").unbind( "click" )
<input type="button" value="新增" id="save" name="cu_save" class="anniu_1" onClick="toAdd();" />$("#sava").removeAttr("onClick");
$("#sava").unbind( "click" )
$("#cu_save").click( function() {
alert("OOOO");
});
$("#sava").unbind( "click" )
楼主这2句是写在画面的ONLOAD方法里的吗?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>JQuery</title>
</head>
<style type="text/css">
body,td,div,input,fieldset,legend{font-family:Verdana; font-size:12px; color:#333333; font-weight:normal;}
.title01{font-weight:bold; font-family:Verdana; font-size:14px;}
.title02{font-weight:bold; font-family:Verdana; font-size:12px; color:#0000FF; display:block;}
a:link,a:visited{font-family:Verdana; font-size:12px; color:#330099; font-weight:normal; text-decoration:none;}
a:hover,a:active{font-family:Verdana; font-size:12px; color:#FF6600; font-weight:normal; }
</style><script language="javascript" type="text/javascript" src="jquery-1.4.2.min.js"></script>
<script language="javascript" type="text/javascript">
function addEvt(){
$("#div01").bind("click",function(){alert($(this).html());});
}function releaseEvt(){
$("#div01").unbind("click");
}function display(){
alert("static function on object");
}
</script>
<body>
<p><br><div id="div01" onClick="javascript:display();">div content 01</div></p>
<a href="javascript:addEvt();">增加事件到DIV</a> <a href="javascript:releaseEvt();">释放DIV的click事件</a>
</body>
</html>
如果还想继续用onclick里面的内容就在相应的条件下再写一个
$("#sava").onclick=function(){
原来的onclick时间的处理方法
}
方法有点笨,但是很实用!
我默认调用的是toAdd
怎么写 a
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>JQuery</title>
</head>
<style type="text/css">
body,td,div,input,fieldset,legend{font-family:Verdana; font-size:12px; color:#333333; font-weight:normal;}
.title01{font-weight:bold; font-family:Verdana; font-size:14px;}
.title02{font-weight:bold; font-family:Verdana; font-size:12px; color:#0000FF; display:block;}
a:link,a:visited{font-family:Verdana; font-size:12px; color:#330099; font-weight:normal; text-decoration:none;}
a:hover,a:active{font-family:Verdana; font-size:12px; color:#FF6600; font-weight:normal; }
</style><script language="javascript" type="text/javascript" src="jquery-1.4.2.min.js"></script>
<script language="javascript" type="text/javascript">
function addEvt(){
$("#div01").bind("click",display);
}function releaseEvt(){
$("#div01").unbind("click");
}function display(){
alert("static function on object");
}
</script>
window.onload=function(){
addEvt();
}
<body>
<p><br><div id="div01">div content 01</div></p>
<a href="javascript:addEvt();">增加事件到DIV</a> <a href="javascript:releaseEvt();">释放DIV的click事件</a>
</body>
</html>
$("#sava").removeAttr("onclick");
window.onload=function(){
addEvt();
}
写在
</script>
前面. :)