If you go to http://www.worldsurfengine.com/Hawaii/home there is a login function. Once logged in, it allows you to click "account" in the same place that "login" is and it makes a div slide down from the menu bar. Basically, I have firebug installed and it doesn''t detect any errors. I have a cookie installed so that the drop down is persistent. The problem is, when the account box starts off hidden, it won''t drop down, but it runs all the scripts correectly, because it sets the cookie to the account box being open. If you refresh, then the box is open, and if you click close, it closes. Without refreshing the page if you click account, NOW the drop down will occur, but if you refresh the page when the box is closed, and try to open it on the new page, it once again won''t open. Any thoughts? Here is an excerpt of the code i''m using: The Javascript Functions Code: <script type="text/javascript"> function toggleAccount() { obj = document.getElementById(''accounttext''); if (obj.innerHTML == "Account") { Effect.SlideDown(''accountinfodiv''); obj.innerHTML = "Close"; $(''menu'').style.borderBottomColor = "transparent"; $(''menu'').style.borderBottomWidth = "0px"; new Ajax.Request(''../includes/setCookie.php'', {parameters: ''setcook=open''}); } else { Effect.SlideUp(''accountinfodiv'') obj.innerHTML = "Account"; setTimeout(''$("menu").style.borderBottomWidth = "thin"; $ ("menu").style.borderBottomColor = "#000000";'', 1000); new Ajax.Request(''../includes/setCookie.php'', {parameters: ''setcook=closed''}); } } </script> HTML Menu Bar (You If you look under $authenticated) you''ll find the onclick-"toggleAccount()": <{if not $authenticated }> <div style="float: right;"><a href="#" title="Login" onclick="Modalbox.show(''../public/loginfunctions.php'', {title: this.title, width: ''650'', height: ''400'', method: ''post'', params: ''submit=Login%20Form&method=Login''}); return false;">Login</a> <img style="vertical-align: middle;" src="/images/bluesurf/seperator.gif" /> <a href="#" title="Login" onclick="Modalbox.show(''../public/loginfunctions.php'', {title: this.title, width: ''650'', height: ''400'', method: ''post'', params: ''submit=Login%20Form&method=Register''}); return false;">Register</a></div> <{/if}> <{if $authenticated }> <div style="float: right;"><a href="#" id="accounttext" onclick="toggleAccount(); return false;">Account</a> <img style="vertical-align: middle;" src="/images/bluesurf/seperator.gif" /> <a href="#" title="Logout" onclick="Modalbox.show(''/public/loginfunctions.php'', {title: this.title, width: 600, height: 400, method: ''post'', params: ''submit=Logout''}); return false;">Logout</a></ div> <{/if}><br /> Any thoughts? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Just a note on debugging: Ajax.Request() and setTimeout() both result in code which is asynchronous (Greek for "impossible to debug" ;-)). I write a blog post awhile back about how to patch both of these scenarios for the purposes of testing, which you might find useful: http://sustainablecode.com/blog/2008/01/testing-ajax-calls-in-prototype.html -Fred On Thu, Jun 12, 2008 at 2:27 AM, Edwartine <brett.hinkle-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > If you go to http://www.worldsurfengine.com/Hawaii/home there is a > login function. Once logged in, it allows you to click "account" in > the same place that "login" is and it makes a div slide down from the > menu bar. > > Basically, I have firebug installed and it doesn''t detect any errors.-- Science answers questions; philosophy questions answers. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks for the response, the weird thing is that the AJAX is just to set the cookie for the persistance as I was having no luck getting javascript to do it for me. The script doesn''t actually rely upon the AJAX and i''ve taken it out and it doesn''t change if it works or not. The other thing is that the timer is just so that the bottom border of the menu doesn''t appear until the dropdown box is closed. Again this is not part of something that is function for the dropdown script and has also been removed during tests. So from my view it doesn''t seem like the setTimeout and AJAX requests are messing it up, but then again i''m still learning Javascript.... much more comfortable in my home state of PHP. :) On Jun 12, 3:27 am, "Frederick Polgardy" <f...-SMQUYeM9IBBWk0Htik3J/w@public.gmane.org> wrote:> Just a note on debugging: Ajax.Request() and setTimeout() both result in > code which is asynchronous (Greek for "impossible to debug" ;-)). I write a > blog post awhile back about how to patch both of these scenarios for the > purposes of testing, which you might find useful: > > http://sustainablecode.com/blog/2008/01/testing-ajax-calls-in-prototy... > > -Fred > > On Thu, Jun 12, 2008 at 2:27 AM, Edwartine <brett.hin...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > If you go tohttp://www.worldsurfengine.com/Hawaii/homethere is a > > login function. Once logged in, it allows you to click "account" in > > the same place that "login" is and it makes a div slide down from the > > menu bar. > > > Basically, I have firebug installed and it doesn''t detect any errors. > > -- > Science answers questions; philosophy questions answers.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---