0
我有一个内容可编辑HTML文件,一个编辑器。 每当我将图像插入编辑器或从编辑器中删除图像时,我都想显示警报。 我该怎么做?任何事件我必须处理。我可以跟踪插入图像,但是如何跟踪移除的图像? 我想在我的编辑器中计算图像的总大小 - 预先加载的图像的大小(如果有)+插入的图像大小以及图像的总数。如何跟踪HTML文件中的图像(插入和删除)
<html>
<head>
<script type="text/javascript">
function InsertImage() {
var imagePath = "D:/\images/\Desert.jpg";
var imageInfo = "<img src='" + imagePath + " ' width='200' height='200'>";
document.execCommand('InsertHTML',false,imageInfo);
}
</script>
</head>
<body>
<input type="submit" value="Image" onClick="InsertImage()" />
<div id="EditBox" contentEditable="true"
style="border: solid 1px red; width: 600px; height: 300px;
overflow-y: scroll; overflow-x: scroll;">
</div>
</body>
</html>