if(img)img.removeNode(true); --
你都移除了 ,还怎么显示呢?

解决方案 »

  1.   

            //检查插入是否为图片
            var img=null;
            function chkimg(inp)
            {
                img=document.getElementById("imgShow");
                img.src=inp;
                isimg();
            }
            function notimg()
            {
                document.getElementById("imgShow").src="../../property/property_img/default.jpg"
                document.getElementById("txtImageSize").value='noimage';
            }
            function isimg()
            {
                var noimage=document.getElementById("txtImageSize").value;
                noimage= img.offsetWidth +"x"+ img.offsetHeight;
            }
    <asp:Image ID="imgShow" runat="server" Height="300px" Width="400px" AlternateText="Can't find a photo" onerror="notimg()" /><asp:FileUpload ID="myUlf" runat="server"/>
    <asp:LinkButton ID="btnUp" runat="server" OnClientClick="chkimg(myUlf.value)" OnClick="btnUp_ServerClick">Upload</asp:LinkButton>为什么点了上传,显示了上传图片的尺寸后,又立马执行了notimg();