[Proto-Scripty] Re: including prototype dynamically, and observe:domloaded

2009-09-20 Thread Rick Waldron
If none of the above work...

document.write('

[Proto-Scripty] Re: including prototype dynamically, and observe:domloaded

2009-09-18 Thread Ngan Pham
Hi jrochkind,
I believe document.write is execute properly and full before your observe
call is done.  However, document.write's job is simply to write the string
to the browser, nothing more.  It's then the browser's job to interpret the
string and do whatever it has to do on a different tangent. In this case,
load an external javascript document.  So immediately after document.write
has performed it's job, the next statement is ran--which causes the problem
for you since the external prototype script is not ready.

As stated above this isn't a good thing to do in general.  However, to
answer your questionyou either of the follow (there may be more
options):
1. Modify the prototype.js file and add a function call at the bottom to let
your page know prototype is loaded.
2. Use a setInterval function to periodically check for prototype's
existence.  Once it's available you can then stop the checking and resume
your code.

On Thu, Sep 17, 2009 at 12:37 PM, Jonathan Rochkind wrote:

>
> Thanks Alex, I think that post does have the right analysis of what
> was going on in my case and why it wasn't working.
>
> And thanks for the alert that loading prototype via document.write in
> general may be a bad idea.
>
> Is there any good way to have an external .js file trigger a load of
> Prototype, or is this basically just a lost cause, and if you want
> Prototype on a page, you've just got to include a 

[Proto-Scripty] Re: including prototype dynamically, and observe:domloaded

2009-09-17 Thread Jonathan Rochkind

Thanks Alex, I think that post does have the right analysis of what
was going on in my case and why it wasn't working.

And thanks for the alert that loading prototype via document.write in
general may be a bad idea.

Is there any good way to have an external .js file trigger a load of
Prototype, or is this basically just a lost cause, and if you want
Prototype on a page, you've just got to include a 

[Proto-Scripty] Re: including prototype dynamically, and observe:domloaded

2009-09-17 Thread Alexander Wallace
While I don't recommend loading prototype via document.write,
this might be due to including both the doc.write(prototype) and the
doc.observe() function within the same enclosing