0 javascript firefox internet-explorer onclick
这是代码 - 它是非常基本的,我无法想到出现了什么问题当点击带有"onclick"代码的小图像时,它在IE中给出了"对象不支持此属性或方法"错误.它在Firefox中运行良好!请帮忙!
<script language="javascript">
function showproduct1()
{
document.getelementbyid("productimg").src = "../images/productimg1.jpg";
}
function showproduct2()
{
document.getelementbyid("productimg").src = "../images/productimg2.jpg";
}
</script>
<a href="javascript:void(0)" title="Product 1">
<img src="../images/productimg1.jpg" style="height: 60px" onclick="showproduct1()" />
</a><br>
<a href="javascript:void(0)" title="Product 2">
<img src="../images/productimg2.jpg" style="height: 60px" onclick="showproduct2()" />
</a>
<a href="../images/productimg1.jpg" target="_blank" title="Click on Image to Expand">
<img src="../images/productimg1.jpg" width="210" border="0" alt="Product" id="productimg">
</a><br>
<br><small><strong>Click on images to expand</strong></small><p><strong>
Run Code Online (Sandbox Code Playgroud)
案件事项:
document.getelementbyid
Run Code Online (Sandbox Code Playgroud)
应该 ...
document.getElementById
Run Code Online (Sandbox Code Playgroud)
更新:我可以确认第一个示例在Fx的最新版本(21.0)中不起作用.