Ok, so Duran Duran never actually used those particular lyrics, and this post isn’t going to interest my regular readers (though I have faith it’ll be as interesting as my regular posts for them).  Nobody will really care except those who happen to stumble on this post after searching for keywords such as “dynamic redraw”, “innerHtml”, “innerText”, “document.write” with “lose”, “clear”, “undo”, “redo”, “buffer” and “IE” or “Internet Explorer”.  Possible also “Mozilla” or “Firefox”.

To make sense of the keywords, basically when you dynamically update part of the text on the screen, Internet Explorer has the nasty habit of clearing the undo/redo buffer.  Mozilla was supposed to have fixed this in a bugfix, but it still does the same thing to me.

Changing form values also has the same effect, so I can’t use a form to update part of the screen for any value otherwise the undo buffer is cleared every time the update is called… basically if I was using such a function now and pressed Alt-Z, nothing would happen.

I make far too many mistakes to not have undo!

Now this was really annoying when I wanted to have a message input area like the one I’m using right now, while also having a status line showing how many characters the user has entered, and the limit they can have.

I did, however, find out you can hide and unhide elements with the style.visibility = “hidden”/”visible” javascript directive, so I originally had a fuel gauge type thing with a bunch of slashes etc

(i.e. it looked like this; [ E\\\\\\\\\\|//////////Full])

And I used to hide all of the slashes except for the appropriate one (and hide the “ull” in “Full” unless it was full.  Simple enough I guess, but not really the nice-ity that a status line of “Using xxx of xxx characters” gave.

So then one day I thought, hmmm, you actually can have HTML overlap each other.  Imagine 0 through to 9 all occupying the same spot on the screen, initially messy yes, but then you only make one of the digits visible… to the user they’d see the appropriate number.  So what if I did that for a bunch of numbers, 0 through to 9 repeated several times, with each repetition adjacent to the other.  Then surely I could only make the appropriate digit of each repetition visible, so I could effectively have a counter without the old dynamic redraw?

Well, after about four hours of javascript hacking coding, I came up with the solution.

And because I know my regular visitors are already bored, I’ll put the code in the comments section. (c;