日期:2014-05-16  浏览次数:20366 次

在线,急等!<img>html控件为何没有disabled属性,如何控件<IMG>可用和不可用,及如何动态增加<IMG>控件的属性.
如题,<img>中为何没有disabled属性,那我如何控制一个<img>控件可用或是不可用呢?

------解决方案--------------------
HTML code
<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>

------解决方案--------------------
HTML code

<input type="image" src="http://www.baidu.com/img/logo.gif" />

<input type="image" src="http://www.baidu.com/img/logo.gif" disabled="true" />

------解决方案--------------------
HTML code

<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" />