Hi,

When you use Element#update[1] (directly, or through Ajax.Updater),
you're giving a string containing *HTML* to be rendered on the page.
So for instance, if your string is "This is <strong>cool</strong>",
you'll see "this is cool" on the page where "cool" is boldface
(usually). You don't actually see "This is <strong>cool</strong>". The
HTML tags are interpreted, just as though the HTML were on the page
itself. (And of course, script tags are never shown on the page.) If
you actually want the HTML tags to be shown, rather than interpreted,
you can pre-process the text so it uses &lt; instead of <, etc.
Prototype has String#escapeHTML[1] to help you with that.

Note that Ajax.Updater[3], if that's what you're using, will by
default extract (and remove) script tags from the response before it
passes the text on to Element#update, and then execute those scripts
for you (if they're inline script, not links to external files). If
you don't want that to happen, you'll need to pass it the
`evalScripts` option with the value `false`. Of course, if you've pre-
processed the text, there's no need to do that (though it will be a
*tiny* bit more efficient), because by the time that happens the
script tags won't be script tags anymore.

Final note: One limitation of adding to the page after it's been
parsed and rendered is that you can't use `document.write` in your
scripts anymore. So if that's what you're doing and you're wondering
why the content created that way isn't showing up, that's why.

[1] http://api.prototypejs.org/dom/element/update/
[2] http://api.prototypejs.org/language/string/prototype/escapehtml/
[3] http://api.prototypejs.org/ajax/ajax/updater/

HTH,
--
T.J. Crowder
Independent Software Consultant
tj / crowder software / com
www.crowdersoftware.com

On May 9, 3:04 am, The Dark Lord <the_dark_lord12...@yahoo.com> wrote:
> how can i explain this where it makes sense.. i have my index page, i
> have links that use prototypes updater to send a request to a php file
> that simply includes a page with the html content for the page... well
> this one page i have has javascript in it... it is all encapsulated in
> the script tag... when i do alert(respond.responseText) it shows the
> entire page with the script tags and other html content, but when it
> gets displayed to the browser, none of the script tags or content in
> the script tags get displayed...
>
> i even tried to use the request and use the $
> ('contentWrapper').innerHTML = respond.responseText but it doesn't
> output the <script> tags or the content within...
>
> am i missing something here? i would greatly appreciate the help... i
> have spent two days trying to figure this out, and just this evening
> is when i narrowed it down to the javascript part...
>
> thanks again for your guys' time :)
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Prototype & script.aculo.us" group.
> To post to this group, send email to prototype-scriptacul...@googlegroups.com.
> To unsubscribe from this group, send email to 
> prototype-scriptaculous+unsubscr...@googlegroups.com.
> For more options, visit this group 
> athttp://groups.google.com/group/prototype-scriptaculous?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptacul...@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to