img内容是否存在求教
<html>
<head>
<script>
function op()
{
var img = document.getElementById("pic");
if (!img) {
img = document.createElement("img");
img.src = "123.jpg";
if(img.src != null)
{
}
else
{
img.style.position = "absolute";
img.style.left = "100px";
img.style.top = "100px";
img.style.zIndex = 0;
img.setAttribute("id", "pic");
img.src = "234.jpg";
p.appendChild(img);
}
}
}
</script>
</head>
<body onLoad="op()">
<div id="p"></div>
</body>
</html>
请问怎样使这段js代码在123.jpg不存在的情况下转而加载234.jpg?