日期:2014-05-16 浏览次数:20386 次
<html> <head></head> <body> <img src='1.gif' onclick='Hello()' id="img1"/><br/> <input type='button' value='移除' onclick="Evt(this)" /> <script> function Evt(b) { var img1=document.getElementById("img1"); if(b.value=="移除") { b.value="绑定"; img1.onclick=null; } else { b.value="移除"; img1.onclick=Hello; } } function Hello() { alert('hello'); } </script> </body></html>
------解决方案--------------------
<input type="image" src="http://www.baidu.com/img/logo.gif" /> <input type="image" src="http://www.baidu.com/img/logo.gif" disabled="true" />
------解决方案--------------------
<input type="image" src="http://www.baidu.com/img/logo.gif" onclick="alert()" /> <input type="image" src="http://www.baidu.com/img/logo.gif" onclick="alert()" disabled="true" />