»
AnglaisFran�aisVietnamien

Imprimer - Undo-Redo script - JavaScriptBank.com

Version compl�te: jsB@nk » Utilitaire » Undo-Redo script
URL: https://www.javascriptbank.com/undo-redo-script.html

Undo-Redo script © JavaScriptBank.comOffrez à vos utilisateurs la possibilité de modifier leurs entrées dans votre textareas. Ajouter cette JavaScript à vos formulaires ou l'utiliser dans un éditeur WYSIWYG.

Version compl�te: jsB@nk » Utilitaire » Undo-Redo script
URL: https://www.javascriptbank.com/undo-redo-script.html



JavaScript
<script type="text/javascript">// Created by: Turnea Iulian :: http://www.eurografic.rofunction iObject() {  this.i;  return this;}var myObject=new iObject();myObject.i=0;var myObject2=new iObject();myObject2.i=0;store_text=new Array();//store_text[0] store initial textarea valuestore_text[0]="";function countclik(tag) {  myObject.i++;  var y=myObject.i;  var x=tag.value;  store_text[y]=x;}function undo(tag) {  if ((myObject2.i)<(myObject.i)) {    myObject2.i++;  } else {    alert("Finish Undo Action");  }  var z=store_text.length;  z=z-myObject2.i;  if (store_text[z]) {  tag.value=store_text[z];  } else {  tag.value=store_text[0];  }}function redo(tag) {  if((myObject2.i)>1) {    myObject2.i--;  } else {    alert("Finish Redo Action");  }  var z=store_text.length;  z=z-myObject2.i;  if (store_text[z]) {    tag.value=store_text[z];  } else {  tag.value=store_text[0];  }}// --></script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<form name=form1>  <input type="button"  class="red" value="Undo" onmousedown="undo(document.form1.text1);">  <input type="button" class="red" value="Redo" onmousedown="redo(document.form1.text1);">  <br>  <textarea rows=7 cols=50  name=text1 onkeydown="countclik(document.form1.text1);" >  </textarea></form><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->