<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> test command </TITLE>
<META NAME="Author" CONTENT="emu">
<SCRIPT LANGUAGE="JavaScript">
<!--
var actionStack = [];//操作栈
var actionIndex = 0;//操作栈中当前操作的指针
//----------------------- command对象基类 ------------------------------
function BaseAction(){
}
BaseAction.prototype.exec=function(){
actionStack[actionIndex++] = this;
actionStack.length = actionIndex;
}
BaseAction.prototype.undo=function(){
alert("此操作未定义相应的undo操作");
}
BaseAction.prototype.redo=function(){
alert("此操作未定义相应的redo操作");
}
//----------------------- move操作的command对象 ------------------------------
function
JavaScript Undo-Redo(根据《在javascript中用command 模式实现undo和redo》修改兼容Firefox)
最新推荐文章于 2022-09-02 10:10:23 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)