想方便一点就改一下就行了!像这样!
<html>
<head>
<script language="javascript">
<!--
var SelObj = null;
function AddElement()
{
var oImg
= document.createElement("IMG");
oImg.src
= "http://www.baidu.com/img/baidu_logo.gif";
oImg.width
= 270;
oImg.height
= 129;
oImg.style.cursor
= "hand";
oFrame.appendChild(oImg);
}
function DelElement()
{
oFrame.removeChild(SelObj);
}
function SelectImage()
{
if(window.event.srcElement.tagName=="IMG")
{
if(SelObj!=null)
{
SelObj.border = 0;
}
window.event.srcElement.border = 2;
SelObj = window.event.srcElement;
}
}
function document_onload()
{
document.all.oAddButton.onclick = AddElement;
document.all.oDelButton.onclick = DelElement;
document.all.oFrame.onclick
= SelectImage;
}
//-->
</script>
</head>
<body onload="document_onload();">
<div id="oFrame">
</div>
<input id="oAddButton" type="button" value="Append" />
<input id="oDelButton" type="button" value="Remove" />
</body>
</html>