document.getElementById(“”)。禁用在Chrome& IE 11

时间:2017-06-20 17:35:41

标签: javascript html google-chrome

document.getElementById()。禁用单元格在IE8中工作。但不适用于Chrome& IE11。我已经粘贴了类似的代码在w3schools尝试编辑。我的要求类似于禁用td元素而不是按钮。我试过display.none。但这完全消除了细胞元素。

<!DOCTYPE html>
<html>
<body>
<table width="400" border="0">
<tr>
<td width="64" id="Submit">
<button id="myBtn">My Button</button>
</td>
</tr>
<p>Click the button below to disable the button above.</p>

<button onclick="myFunction()">Try it</button>

<script>
function myFunction() {
    document.getElementById("Submit").disabled=true;
}
</script>

</body>
</html>
<td width="64" id="Submit">
  <a href="#" title="<s:text name="Submit"/>" onClick="if(!this.disabled){fn_Submit();" >
    <table cellpadding=0 cellspacing="0" class="menublue" style="cursor:hand">
      <tr>
        <td width="10"><img src="../image/button_left_part.gif" width="10" height="23" border="0" ></td>
        <td  nowrap="true" align="left" background="../image/button_middle_part.gif"><span class="buttonText"><s:text name="Submit"/></span></td>
        <td width="10"><img src="../image/button_right_part.gif" width="10" height="23" border="0" ></td>
      </tr>
    </table>
  </a>
</td>

2 个答案:

答案 0 :(得分:-2)

        CGImage imageRef = image.CGImage;
        int width = (int)image.Size.Width;
        int height = (int)image.Size.Height;
        CGColorSpace colorSpace = CGColorSpace.CreateDeviceRGB();
        byte[] rawData = new byte[height * width * 4];
        int bytesPerPixel = 4;
        int bytesPerRow = bytesPerPixel * width;
        int bitsPerComponent = 8;
        CGContext context = new CGBitmapContext(rawData, width, height,
                        bitsPerComponent, bytesPerRow, colorSpace,
                        CGBitmapFlags.PremultipliedLast | CGBitmapFlags.ByteOrder32Big);

        context.DrawImage((CGRect)new CGRect(0, 0, width, height), (CGImage)imageRef);     

        // Now your rawData contains the image data in the RGBA8888 pixel format.
        int pixelInfo = (width * y + x) * 4; // The image is png
        //red,green, blue,alpha
        byte red = rawData[pixelInfo];
        byte green = rawData[pixelInfo+1];
        byte blue = rawData[pixelInfo+2];
        byte alpha = rawData[pixelInfo + 3];

看看这是否有效,希望它有所帮助。

答案 1 :(得分:-2)

在发现错误之前,请继续删除内容以简化操作。

&#13;
&#13;
function myFunction() {
  document.getElementById("Submit").disabled = true;
}
&#13;
<!DOCTYPE html>
<html>

<body>
  <button onclick="myFunction()">myFunction</button>
  <button id="Submit">Submit</button>
</body>

</html>
&#13;
&#13;
&#13;