I'm not a language expert but this looks like a scope problem. Have you tried replacing "page" with "window.page" everywhere?
-Rob Ben Anderson wrote: > Hi, > I have a misunderstanding of what I though evalScripts would do vs > what it actually does. I'm wondering if there's a way that I can make > it do what I want. > > my initial page: > <html> > <head> > <script... > var page = 'initial'; > ... > <body> > <div id="replaceMe" > <script... > page = 'in body'; > ... > <input type="button" onclick="alert(page);" /> > </div> > ... > > ok, so when I click on my button, it says "in body". > now I use Ajax.Update (with evalScripts set to true) and replace my > "replaceMe" div with: > <script... > page = 'in body from ajax'; > ... > <input type="button" onclick="alert(page);" /> > > and the button, when clicked, still displays "in body" > > I read this page (specifically the part above "Enumerating... Wow! > Damn! Wahoo!"), which seems to make sense. It looks like you can > create new page script variables that way (I didn't try the example - > I just assume it works). However, it doesn't seem to let you reassign > values to page script variables (which is what I'm trying in the above > example) > > Any ideas? > > Thanks, > Ben > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs