"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes:

So far I have:

<div id="infotarget">
</div>

in my html body to hold the text that I want put in there.

But I'm having trouble coming up with the javascript function with
mochikit that will put the text there!

Can someone please take pity on me, and give me a simple example as to
how to do this?

There are "two" ways of doing that: using DOM or using .innerHTML.  The first
provides you with more fine grained controls but requires more work on your
side.  The second isn't a standard but works on most browsers, but not
everywhere.

DOM approach (using MochiKit, of course):

   my_dyn_content = DIV({'id':'infotarget'}, P('this is a para inside the 
div!'));
   replaceChildNodes('infotarget', my_dyn_content);

.innerHTML approach (also using MochiKit):
   $('infotarget').innerHTML = '<p>this is a para inside the div</p>';

Whenever possible use the DOM approach.  It is better style.  (You'll find a
lot of things on Google that says that .innerHTML is or isn't a problem as
well as the restrictions on where you can use it...  Go there and read them!)


Be seeing you,
--
Jorge Godoy      <[EMAIL PROTECTED]>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to