Undo System For Text

Jul 23, 2005

I`m writing a javascript regex tester (IE 6 only) and would like to include
an undo button for a text input field.

I want it to handle individual keystrokes, pasting and drop, and also
text added by clicking various buttons.

I have tried a LOT of handler combinations and fancy conditionals to
make it work perfectly, and I`m ALMOST there.

View 3 Replies


ADVERTISEMENT

JQuery :: Text Undo Redo Machanism Like Googledocs/MS Word

Sep 6, 2010

I find most rich internet text editors, developers put in the product many many features but fail to make a decent undo redo mechanism, I pressed crtl+z they deleted my whole paragraph. Unlike googledocs's one, it knows exactly what to undo.

If anyone can let me know what the logic of google docs/Ms word machanism is, maybe I can give it shot building one.

View 1 Replies View Related

Poll System And Xml / Text File?

Jun 29, 2011

I need poll system only in javascript and xml/text file.

example: What is your age ?
option: 10
option: 20
option: 30
option: 40

Button Vote and Result show result in same div in Bar

View 1 Replies View Related

How Can I Restrict ExecCommand('undo') To A <div>?

Jul 23, 2005

I am using IE 6.0. On a page, I have placed a contenteditable div
which I want to use as a Rich Text Area. I am using the execCommand method of
the document to control bold, italics, underlining, and undo for this div.

I have placed an input element on the page to. All but the undo, are
restricted to working only on the div. How can I restrict the undo to
working on only the div?

Below is the complete page so you can see what I am talking about.
Just paste it into an htm file and traverse to it via your browser.
Type something in the div and the input and then try the buttons. Code:

View 3 Replies View Related

Undo Redo Function

Jun 8, 2004

<!--

I'm working on an undo-redo function. Couldnt really find anything useful in the internet.
So I have a try. Guess it could be quite useful for a lot of people out there.

Wonder if the concept is any good?

Please critizise hard!
Try it out if you dare!
Any feedback is welcome!
All suggestions are appreciated!

Yours

Axinya

-->
<html>
<head>
<style type="text/css">
<!--
#wisiwig {
overflow: auto;
position: relative;
height: 300px;
width: 600px;
margin-top: 5px;
padding: 5px;
border: thin groove #999999;
}
-->
</style>
<script language="JavaScript">
<!--
var b_ackup = new Array(); //Store data in Array
var undo_pos= 0;//Position of undo
var flag = false;// shall we start new undo thread and delete obsolete items?
var w_isiwig;//editor interface

function init(){
w_isiwig = document.getElementById("wisiwig");
w_isiwig.contentEditable = true;
w_isiwig.onkeyup = HandleKeys;
b_ackup[0] = w_isiwig.innerHTML;
}

function HandleKeys(evt) {//events to write to backup
//
if (event) {

switch (event.keyCode) {
case 32:
BACKUP();
break;
case 8:
BACKUP();
break;
case 13:
BACKUP();
break;
case 46:
BACKUP();
break;
default:
return;
}
}
}

function BACKUP(){

if (flag){// action if undo was clicked

var removed= b_ackup.splice(flag,b_ackup.length - flag);
for (var i = 0; i < removed.length; i++) {
delete removed[i];//delete obsolete array items
}

b_ackup[b_ackup.length] = w_isiwig.innerHTML;
undo_pos = b_ackup.length - 1;
flag = false;
w_isiwig.focus();

}
else{//write to backup array
b_ackup[b_ackup.length] = w_isiwig.innerHTML;
undo_pos = b_ackup.length - 1;
flag = false;
w_isiwig.focus();
}
}

function undo(){

if (b_ackup.length){//

if(undo_pos==0){w_isiwig.focus();return;}// beginning of backup items

if(flag == false){BACKUP();}// save last state of document

w_isiwig.innerHTML=b_ackup[undo_pos -1];

undo_pos=undo_pos - 1;

flag = undo_pos +1;

look();

w_isiwig.focus();
}
}

function redo(){
if(undo_pos == b_ackup.length -1){w_isiwig.focus();return;}
//end of backup array

w_isiwig.innerHTML=b_ackup[undo_pos +1];

undo_pos=undo_pos + 1;

flag = undo_pos +1;
look();
w_isiwig.focus();

}

function look(){// monitor our Array data
var e='flag:'+flag+'
undo_pos:'+undo_pos+'
'
e+='b_ackup.length:'+b_ackup.length+'
'
for (i=0; i<b_ackup.length; i++){

e+= 'Backup item '+i+':'+b_ackup[i]+'
'
}
document.getElementById('bup_a').value=e;
}

</script>
<title>undo-redo</title>
</head>
<body id = "body" onload= "init();">
<p><b>undo/redo</b> <br>
development version: for <b>IE</b> only<br>
Backup written by <b>'onkeyup'</b> event(space,back,return,del), or
<b>'add to backup'</b> button. </p>
<div id="menu">
<a href="#" onclick='BACKUP();return false'>[add to backup]</a>
<a href="#" onclick='setTimeout("undo()",10)'>[undo]</a>
<a href="#" onclick='setTimeout("redo()",10)'>[redo]</a>
<a href="#" onclick='look()'>[view backup-data]</a> </div>
<div id="wisiwig">Type text: </div>
Backup Array Data: <br>
<div id="bup">
<textarea id="bup_a" name="bup_a" cols="80" rows="6"></textarea>
</div>
</body>
</html>

View 8 Replies View Related

Possible To Do A CTRL-z (undo) In On-click Event

Sep 29, 2010

is it possible to do a CTRL-z (undo) in a onclick event ?

View 3 Replies View Related

System Variables

Oct 6, 2006

I need a javascript that will display all system variables (e.g. HTTP_REFERER). I am not a programmer, so if you could post all of the html and stuff that would be great. Code:

View 5 Replies View Related

Particle System

Jul 8, 2007

I'm not quite sure if this is useful, but it's fun to watch :) . It displays a Particle System in which point masses gravitate toward each other.

Simple unzip the attachment, open TEST.html, and run:

var vps = new VisibleParticleSystem(canvas).randomizeParticles(10);
vps.run();

It works in Firefox, doesn't in IE, unsure about others.

View 1 Replies View Related

3D Lindenmayer System

Nov 7, 2007

I recently found out about L-systems (Lindenmayer systems) which are fairly interesting so I decided to make one in javascript. It uses the <canvas> tag so the code won't run in IE. I made a 2D version first and then decided to expand it into 3D because I think 3D stuff is much cooler. I tried to comment the source a bit. You can use the code for anything you like. It does include a simple 3D engine which can work with things made up of lines. Here is a link.

View 1 Replies View Related

Want To Logged Out From The System?

Aug 24, 2010

I have a problem. When i want to logged out from the system or close an account etc i want to display this message. " Are you sure you want to logged or something like" and "Yes and " No" buttons are there.

View 2 Replies View Related

Tab System Refresh Same Tab

Oct 22, 2009

Does anyone know of a tutorial or the proper name for a tab system that will stay on the current tab even if you refresh.I've seen some sites that what they do is pass some parameters in the URL and it allows them refresh the page and stay on the same tab.I'm not sure on how to explain it properly nor do I have the proper name for it.if I click on About tab it will show the content of that tab AND also allow you to stay on that tab even if you refresh. A lot of tab tutorials I've seen when you refresh it resets all tabs.

View 7 Replies View Related

Rating System

Dec 13, 2005

I was wondering if anybody had code for a rating system, like on alot of game sites it has stars and I was wondering how to do that,

View 2 Replies View Related

System Location

Jan 22, 2006

I have a script that displays the system time as the date but is there one that also displays the system location? For example "Location: Poland , Date: Sunday January 22, 2006" or "Location: Russia, Date: Sunday January 22, 2006"

View 1 Replies View Related

JavaScript Documentation System

Jul 23, 2005

We have a JavaScript SDK with lots of classes and functions. We would like to generate automatic HTML documentation from it to our users. We look for a free tool, something like Doxygen, that knows how to handle JS code.

View 2 Replies View Related

Get The Currenty Date Of The System

Mar 24, 2006

Someone knows obout how i get the currenty date of the system in JavaScript?

View 3 Replies View Related

Get System Properties Using Script?

Aug 11, 2011

Can any body tell, how to get system properties using javascript? I need to get logged-in username and domain name by using javascript.

View 2 Replies View Related

Create A Voting System?

Dec 23, 2010

I run a site on tumblr. I know its not as good as wordpress and doesn't allow as many options but I am looking to create a unique voting option for each post. Like an up down vote. Any ideas on how to set this up?

View 3 Replies View Related

Forum System From Php Using Iframes?

Dec 15, 2011

I have both the java script and the php files, i just need to intergrate them into eachother to display the different topics and forums:

New Forum:

index.php :

<?php
include('../includes/db_connect.php');
include('../includes/inc-logincheck.php');

[code]....

View 4 Replies View Related

Secure Password System

Aug 28, 2006

My idea is to create a safety system that indicates the safety of the password. I have a field in a form called PASSWORD and I want that if the person writes only letters by means of a document.write there appears a phrase that says: easy password. If more than 8 letters appear: medium password. And if writes letters and numbers appear: high password.

View 3 Replies View Related

How To Use Magento E-commerce System

Oct 1, 2009

I'm learning how to use Magento e-commerce system, I'm reading its documentation but I don't understand some term, a "pre-compiled JavaScript library", what do they mean by that?, how can JavaScript code be compiled?

The web downloader for upgrading and installing Magento without the use of SSH (covered in Chapter 2). • js—The core folder where all JavaScript code included with the installation of Magento is kept. We will find all pre-compiled libraries of JavaScript here.

source: [URL]

View 1 Replies View Related

IE8 - Use The Popup System Described In The Link Above

Apr 14, 2011

[URL] I'm trying to use the popup system described in the link above. It seems to work in everything except IE8. It even works in IE7. In IE8 it seems to only open the popup in the same window. how to get this to also work in IE8?

View 1 Replies View Related

File System Access In Mozilla

Oct 23, 2005

I'm considering writing a program in Javascript with Mozilla XULRunner.
(This would be a fully privileged XUL program, not a web page, so it
wouldn't be sandboxed.) This program requires full access to the
filesystem, which it looks like Mozilla's File class can provide.

However, my program needs to not only read these files; it also has to
read their metadata, such as their various timestamps and security
information. (I realize this stuff is platform-specific.) Does anybody
know if I can do that?

View 1 Replies View Related

Voting System With Horiztontal Bars

Nov 16, 2009

Does anyone know a good example on where to find something that when I click on vote it calculates the results and then shows me horizontal bars to show the percentage for each vote? There will only be two?

View 3 Replies View Related

Auto-login To Another Windows System

Jan 21, 2010

I have a js script to unlock a user account on my windows xp system below. Can anybody help me for a js code which can be used to connect to another windows system in the network with a username and password and run this script on that system and ends the session? the script can be placed to that system. I just need a script which logins to that system and run this script on a periodic basis and ends the session after that. The current script "autolock.js", unlocks the user account which has been locked by invalid password tries.

View 1 Replies View Related

Log Out Of System When Close Browser Window?

Jul 11, 2011

I've got a chat program which relies on a column in a MySQL database to see if he/she has logged out or not. But if you close the browser window, the computer still thinks you're online. I wrote this in the JavaScript section cos I think it would definitely need Javascript.

View 5 Replies View Related

Load Xml From Local File System

Feb 20, 2009

is it possible to load xml from local file system using ActiveXObject("Microsoft.XMLDOM") ?

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved