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

onclick=“” 怎么一直都执行
onclick=“” 怎么一直都执行,写个alert测试一下,也不执行,点击了之后没有任何反应,连那句alert都不执行。
<table width="250" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td width="60" rowspan="2"><input name="shuliang" type="text" class="shuliang" id="shuliang" value="1" size="8" maxlength="3" /></td>
                  <td><img src="images/add.gif" width="28" height="15" border="0" style="cursor:pointer" onclick="javascript:add();" /></td>
                  <td rowspan="2" class="huise">库存 999件 </td>
                </tr>
                <tr>
                  <td><img src="images/minus.gif" width="28" height="15" style="cursor:pointer" onclick="javascript:minus();" /></td>
                  </tr>
              </table>


<script language=javascript>
var shuliang=document.getElementById("shuliang").value;
function add()
{
alert("111");
   if(shuliang != '' && !isNaN(shuliang)){
    document.getElementById("shuliang").value = shuliang + 1;
   }else{
    document.getElementById("shuliang").value = 1;
   }
}
function minus()
{
   if(shuliang != '' && !isNaN(shuliang)){
    document.getElementById("shuliang").value = shuliang - 1;
   }else{
    document.getElementById("shuliang").value = 1;
   }
}
 }
</script>