html image javascript

how to show alternate image if source image is not found? (onerror working in IE but not in mozilla)

I need to show an alternate image in cell of table if source image is not found.
Currently below code is used to do so.

cell.innerHTML="<img height=40 width=40 src="<%=request.getContextPath()%>/writeImage.htm" onError="ImgErrorVideo(this);">" 
function ImgErrorVideo(source){
source.src = "";
source.onerror = "";
return true;

Now the problem is that the above is solution is working in Internet Explorer but not in mozilla.

Please tell me some solution which works in all browsers.