This is pretty simple, it merely "types" your
text/html onto the webpage. There are a number of ways of doing this, but this
one seems to be both the fastest and least complex when it comes to rendering
HTML within the text. There are a few problems which are outlined below:
- Although most HTML is rendered correctly, it is obvious that things such
as tables are not going to be shown correctly because they require an ending
tag before they can be rendered.
- Unlike tags, meta characters like "e; (the " sign), are not looked
for. This means that it is possible for only half of the character's value to
be written before the display is updated This means that weird text might
appear while the parser passes over the character's value. This is reasonably
simple to fix by forcing the parser to continue looping until it finds a ";"
character after finding a "&" character.
- The render speed begins to suffer as more and more text becomes visible.
I'd assume that the most effective way of solving this would be to divide ones
text up into multiple blocks. Then all you'd need is a bit of fancy scripting
to start rendering each new block as the previous one finishes.
- Err, and a few other things that I can't think of right now.
How
did I do it? Here's a quick rundown. Firstly we give a <FONT> tag an ID
then manipulate the text within this block using it's .innerHTML
property. You could however use any other tag that has this property. To begin
with, we copy the value of this property to a temporary variable. From then on,
to make the text seem to appear, we simply copy more and more from the temporary
variable back to the .innerHTML property.