[thelist] JS realtime update for preview fun

Tom Dell'Aringa pixelmech at yahoo.com
Mon Jul 1 19:22:01 CDT 2002


Hey, I'm starting to really like this thing - its "cool" (I'll
probably be bored of it in a minute)...

Anyway - you can even do style formatting! Type this in:

czxvzxcvvzxcv
<p>new para</p>
<p><b>bold text</b> how do you like me now? <p style='font-size:
152px; color: red;'>hi</p>

It will color the text and size it accordingly. Now, what I am
wondering is WHY this happens..maybe there is a use for this..(or
maybe not..). Anyway, its like innerHTML is parsing the tags in real
time.

I believe the reason this works is because you are sending brand new
markup to the DIV element, and its tagged with HTML. Now if that is
what you are taking into your DB or whatever for your CMS - that
should be perfect for you.

You should even be able to use a button to "style" a word as bold,
and shortly after see the "preview" update.

Now, the setTimeout probably is not a good idea - I think if you
change it to setInterval (and assign it to a variable) you will be
using the correct method. Have it check at intervals of a couple
seconds or whatever you want, and when the page submits clear the
interval for clean up.

Tom

=====
var me = tom.pixelmech.webDeveloper();
http://www.pixelmech.com/

__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com



More information about the thelist mailing list