Page is a not externally linkable
Rain_Lover - 7:53 am on Nov 28, 2012 (gmt 0)
That's exactly what I see.
Please let me provide two examples:
1. Enter a sentence/code into the text field. Then select/highlight it. Now press the 'Delete' button on your keyboard. You won't see the same change on the iframe unless the textarea loses focus.
2. Enter a sentence and then delete all the letters using the 'backspace' key. You'll see the last letter remains in the iframe.
As I said the iframe content is supposed to get updated in real time -- as soon as the textarea content changes by keyboard or mouse. This approach is an alternative to the oninput event. But since oninput isn't well-supported across different browsers I decided to create a timer to compare the current text field value with its value in 10 milliseconds before. Something like this:
function displayResult() {
if (textarea.value != textarea.value.10ms.ago) {
iframe.open();
iframe.write(textarea.value);
iframe.close();
}
window.setTimeout(displayResult, 10);
}