[Rails-spinoffs] Re: Prototype Question
Beat you by 2 mins Christophe... but yours was quicker with the instead of space :) On 6/9/07, Christophe Porteneuve [EMAIL PROTECTED] wrote: Hey, Camsoft a écrit : This is what I did and it works. But I was wondering if there was an easier way without having to use an anonymous function? Certainly. As emphasized on the pages for each and map/collect, calling the same function with identical arguments throughout an enum is an optimized use-case: use invoke, as in the rewrite below. $$('#idSelector li').invoke('addClassName', 'myClass'); (btw, I used '' instead of a simple space because you said you wanted only children li's to be affected. If you're going for descendants, do use a simple space instead of the closing angular bracket. -- Christophe Porteneuve aka TDD [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~--~~~~--~~--~--~---
[Rails-spinoffs] Re: Prototype Question
Thats great, thanks all for your help, that worked well. On 9 Jun, 10:43, Gareth Evans [EMAIL PROTECTED] wrote: Beat you by 2 mins Christophe... but yours was quicker with the instead of space :) On 6/9/07, Christophe Porteneuve [EMAIL PROTECTED] wrote: Hey, Camsoft a écrit : This is what I did and it works. But I was wondering if there was an easier way without having to use an anonymous function? Certainly. As emphasized on the pages for each and map/collect, calling the same function with identical arguments throughout an enum is an optimized use-case: use invoke, as in the rewrite below. $$('#idSelector li').invoke('addClassName', 'myClass'); (btw, I used '' instead of a simple space because you said you wanted only children li's to be affected. If you're going for descendants, do use a simple space instead of the closing angular bracket. -- Christophe Porteneuve aka TDD [EMAIL PROTECTED] Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~--~~~~--~~--~--~---
[Rails-spinoffs] Re: Prototype question invalid error in IE6
I've been testing the code with alerts and determined the script I was using to get the viewport size wasn't working. So I tried a different one and this one returns a correct size. But when a try to assgin it to a variable it fails with the error Object required in IE6 script type=text/javascript var Client = { viewportWidth: function() { return self.innerWidth || (document.documentElement.clientWidth || document.body.clientWidth); }, viewportHeight: function() { return self.innerHeight || (document.documentElement.clientHeight || document.body.clientHeight); }, viewportSize: function() { return { width: this.viewportWidth(), height: this.viewportHeight() }; } }; var winHeight = Client.viewportHeight(); // The one below wasn't working so I tried this, same Object required //var new_margin = Math.max(0, (Client.viewportWidth()/2)-268); //var new_margin = 175; //var new_margin = winHeight; function init() { alert(Client.viewportHeight()); //alert(new_margin); alert(winHeight); //$('timeline').setStyle({ // marginTop: new_margin + 'px' //}); } window.onload = init; /script On Mar 13, 7:35 pm, andymadonna [EMAIL PROTECTED] wrote: Thanks Tom, I entered the new_margin = Math.max(0, (winHeight/2)-268); you suggested. It still works in Firefox, but I still get the Invalid argument error. On Mar 13, 7:21 pm, Tom Gregory [EMAIL PROTECTED] wrote: I had a similar problem recently with IE. Turns out the measurements I'd get from the two were different, such that a div's top plus its height were greater than the document height--so when I subtracted, I ended up with a negative number. Without any sort of testing, I bet your problem is here: new_margin = (winHeight/2)-268; Try this: new_margin = Math.max(0, (winHeight/2)-268); You may also run into problems if you're trying to get the element heights/widths before the page is fully loaded... TAG On Mar 13, 2007, at 5:15 PM, andymadonna wrote: Hi, I'm new to using Prototype and script.aculo.us. I'm trying to use prototype to adjust an elements top margin based on the height of the screen. I'm also using script.aculo.us to make the element move negatively off the left of the window to create a scrolling effect. It works fine in Firefox, but I keep getting an Invalid argument error in IE6. Here my margin code in the header: var winWidth, winHeight, d=document; if (typeof window.innerWidth!='undefined') { winWidth = window.innerWidth; winHeight = window.innerHeight; } else { if (d.documentElement typeof d.documentElement.clientWidth!='undefined' d.documentElement.clientWidth!=0) { winWidth = d.documentElement.clientWidth winHeight = d.documentElement.clientHeight } else { if (d.body typeof d.body.clientWidth!='undefined') { winWidth = d.body.clientWidth winHeight = d.body.clientHeight } } } var new_margin = (winHeight/2)-268; function init() { $('timeline').setStyle({ marginTop: new_margin + 'px' }); } window.onload = init; /script And heres my link in the body that moves it: a href=javascript:void(0) onclick=new Effect.MoveBy('timeline', 0, - winWidth);Click/a The whol thing it self it a timeline of the 60s. I hope to add more cool effects. Any help would be greatly appreciated! Thanks! --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~--~~~~--~~--~--~---
[Rails-spinoffs] Re: Prototype question invalid error in IE6
I had a similar problem recently with IE. Turns out the measurements I'd get from the two were different, such that a div's top plus its height were greater than the document height--so when I subtracted, I ended up with a negative number. Without any sort of testing, I bet your problem is here: new_margin = (winHeight/2)-268; Try this: new_margin = Math.max(0, (winHeight/2)-268); You may also run into problems if you're trying to get the element heights/widths before the page is fully loaded... TAG On Mar 13, 2007, at 5:15 PM, andymadonna wrote: Hi, I'm new to using Prototype and script.aculo.us. I'm trying to use prototype to adjust an elements top margin based on the height of the screen. I'm also using script.aculo.us to make the element move negatively off the left of the window to create a scrolling effect. It works fine in Firefox, but I keep getting an Invalid argument error in IE6. Here my margin code in the header: var winWidth, winHeight, d=document; if (typeof window.innerWidth!='undefined') { winWidth = window.innerWidth; winHeight = window.innerHeight; } else { if (d.documentElement typeof d.documentElement.clientWidth!='undefined' d.documentElement.clientWidth!=0) { winWidth = d.documentElement.clientWidth winHeight = d.documentElement.clientHeight } else { if (d.body typeof d.body.clientWidth!='undefined') { winWidth = d.body.clientWidth winHeight = d.body.clientHeight } } } var new_margin = (winHeight/2)-268; function init() { $('timeline').setStyle({ marginTop: new_margin + 'px' }); } window.onload = init; /script And heres my link in the body that moves it: a href=javascript:void(0) onclick=new Effect.MoveBy('timeline', 0, - winWidth);Click/a The whol thing it self it a timeline of the 60s. I hope to add more cool effects. Any help would be greatly appreciated! Thanks! --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~--~~~~--~~--~--~---
[Rails-spinoffs] Re: Prototype question invalid error in IE6
Thanks Tom, I entered the new_margin = Math.max(0, (winHeight/2)-268); you suggested. It still works in Firefox, but I still get the Invalid argument error. On Mar 13, 7:21 pm, Tom Gregory [EMAIL PROTECTED] wrote: I had a similar problem recently with IE. Turns out the measurements I'd get from the two were different, such that a div's top plus its height were greater than the document height--so when I subtracted, I ended up with a negative number. Without any sort of testing, I bet your problem is here: new_margin = (winHeight/2)-268; Try this: new_margin = Math.max(0, (winHeight/2)-268); You may also run into problems if you're trying to get the element heights/widths before the page is fully loaded... TAG On Mar 13, 2007, at 5:15 PM, andymadonna wrote: Hi, I'm new to using Prototype and script.aculo.us. I'm trying to use prototype to adjust an elements top margin based on the height of the screen. I'm also using script.aculo.us to make the element move negatively off the left of the window to create a scrolling effect. It works fine in Firefox, but I keep getting an Invalid argument error in IE6. Here my margin code in the header: var winWidth, winHeight, d=document; if (typeof window.innerWidth!='undefined') { winWidth = window.innerWidth; winHeight = window.innerHeight; } else { if (d.documentElement typeof d.documentElement.clientWidth!='undefined' d.documentElement.clientWidth!=0) { winWidth = d.documentElement.clientWidth winHeight = d.documentElement.clientHeight } else { if (d.body typeof d.body.clientWidth!='undefined') { winWidth = d.body.clientWidth winHeight = d.body.clientHeight } } } var new_margin = (winHeight/2)-268; function init() { $('timeline').setStyle({ marginTop: new_margin + 'px' }); } window.onload = init; /script And heres my link in the body that moves it: a href=javascript:void(0) onclick=new Effect.MoveBy('timeline', 0, - winWidth);Click/a The whol thing it self it a timeline of the 60s. I hope to add more cool effects. Any help would be greatly appreciated! Thanks! --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~--~~~~--~~--~--~---
[Rails-spinoffs] Re: Prototype question....
Did I say that I love this community? You don't see a thread like this on a newb question too often elsewhere. Please keep it up. :) *slapsbacks* Best, Thomas --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~--~~~~--~~--~--~---
[Rails-spinoffs] Re: Prototype question....
Thomas Fuchs wrote: Did I say that I love this community? You don't see a thread like this on a newb question too often elsewhere. Of course the flip-side is why does it take 20-odd responses to answer a newb question? -- Fred --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~--~~~~--~~--~--~---
[Rails-spinoffs] Re: Prototype question....
I'd say, better too many than none. I guess he just didn't quite get across what the problem was. :) -Thomas Am 04.12.2006 um 13:42 schrieb Fred: Thomas Fuchs wrote: Did I say that I love this community? You don't see a thread like this on a newb question too often elsewhere. Of course the flip-side is why does it take 20-odd responses to answer a newb question? -- Fred -- Thomas Fuchs wollzelle http://www.wollzelle.com questentier on AIM madrobby on irc.freenode.net http://www.fluxiom.com :: online digital asset management http://script.aculo.us :: Web 2.0 JavaScript http://mir.aculo.us :: Where no web developer has gone before --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~--~~~~--~~--~--~---
[Rails-spinoffs] Re: Prototype question....
And as in many lists like this, he was suffered with several pedantic comments from people on how he was posting wrong, or doing this wrong, or etc... But the net result was good :) On 12/4/06, Thomas Fuchs [EMAIL PROTECTED] wrote: I'd say, better too many than none. I guess he just didn't quite get across what the problem was. :) -Thomas Am 04.12.2006 um 13:42 schrieb Fred: Thomas Fuchs wrote: Did I say that I love this community? You don't see a thread like this on a newb question too often elsewhere. Of course the flip-side is why does it take 20-odd responses to answer a newb question? -- Fred -- Thomas Fuchs wollzelle http://www.wollzelle.com questentier on AIM madrobby on irc.freenode.net http://www.fluxiom.com :: online digital asset management http://script.aculo.us :: Web 2.0 JavaScript http://mir.aculo.us :: Where no web developer has gone before -- Ryan Gahl Application Development Consultant Athena Group, Inc. Inquire: 1-920-955-1457 Blog: http://www.someElement.com --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~--~~~~--~~--~--~---
[Rails-spinoffs] Re: Prototype question....
I just wanna say that I am very appreciative of the help.. I hope in the future I can be more to the point and simplistic in my request and explaination so that I might get the fastest help possible.. LOL I must say though.. this 'thread' has a lot of attention ! ? blushes lol Thanks guys!! :) Now if i can just figure out why that clicked div sometimes stays highlighed to the hover color!! Terry On 12/4/06, Ryan Gahl [EMAIL PROTECTED] wrote: And as in many lists like this, he was suffered with several pedantic comments from people on how he was posting wrong, or doing this wrong, or etc... But the net result was good :) On 12/4/06, Thomas Fuchs [EMAIL PROTECTED] wrote: I'd say, better too many than none. I guess he just didn't quite get across what the problem was. :) -Thomas Am 04.12.2006 um 13:42 schrieb Fred: Thomas Fuchs wrote: Did I say that I love this community? You don't see a thread like this on a newb question too often elsewhere. Of course the flip-side is why does it take 20-odd responses to answer a newb question? -- Fred -- Thomas Fuchs wollzelle http://www.wollzelle.com questentier on AIM madrobby on irc.freenode.net http://www.fluxiom.com :: online digital asset management http://script.aculo.us :: Web 2.0 JavaScript http://mir.aculo.us :: Where no web developer has gone before http://www.someElement.com -- I have learned that you should'nt compare yourself to others - they are more screwed up than you think. ...unknown In the 60's, people took acid to make the world weird. Now the world is weird and people take Prozac to make it normal. ..unknown _ Terry Remsik stripe-man.dyndns.org [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~--~~~~--~~--~--~---
[Rails-spinoffs] Re: Prototype question....
Well... Fred, usually because newb questions are unclear, confused and so is their code... --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~--~~~~--~~--~--~---
[Rails-spinoffs] Re: Prototype question....
Thanks for the Replies... (again) Although it's spaghetti and I didn't even get the slightest idea what you're trying to accomplish Spaghetti ? Whats spaghetti? Its fairly clean code. As I have mentioned... its concept. Not production code. I am simply trying to do an onlick on the div ID that does the same thing as the right content does. Yes.. i have included previous attempt of the code IN the code commented out so that i know not to try it again. But Spaghetti ? Can you enlighten me as to how the code should look ? ..maybe you should take it slowly -... . I am trying to take it slow. But trying to hit this hard. I am excited and energized by prototype! I have tried desperately to put into words what im trying to do (see first few messages).. in plain English.. This ask for help is the first serious attempt to write to this list (or any list for that matter) I will attempt to be more clear in the future. Again.. I appreciate any assistance, or suggestions on figuring out my problem. What do i need to specify, clarify, or fix so that and we can get back to the matter at hand ? Thanks so much for your time and patience again... Terry On 12/3/06, Mislav [EMAIL PROTECTED] wrote: On Dec 2, 11:02 pm, Stripe-man [EMAIL PROTECTED] wrote: The suggestion didnt work. Please advise... I had a quick glance at the files you've sent. Although it's spaghetti and I didn't even get the slightest idea what you're trying to accomplish, I have an advice for you: Be more clear about what you're doing. Use Firefox with Firebug and log stuff what happen with console.log(). When you supply examples or example files, please keep them minimal, and don't require us to run PHP to see it. Also, maybe you should take it slowly - the learning curve of JavaScript is not so flat and trying to pack a single page with as many features and effects as you can isn't going to get you somewhere real quick... instead, it'll get you nowhere real slow. -- Mislav -- I have learned that you should'nt compare yourself to others - they are more screwed up than you think. ...unknown In the 60's, people took acid to make the world weird. Now the world is weird and people take Prozac to make it normal. ..unknown _ Terry Remsik stripe-man.dyndns.org [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~--~~~~--~~--~--~---
[Rails-spinoffs] Re: Prototype question....
Hi Terry, If you want assistance: 1. explain clearly what you want to do. 2. isolate the issue that is causing problems. 3. provide a link to a test case of that issue. 4. make sure your code and markup are valid. 5. remove anything that is useless or not pertinent to the issue at hand. I'd be most happy to help you once you provide the above. Have you downloaded and used Firebug? Regards, Tobie -- Tobie Langel http://tobielangel.com --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~--~~~~--~~--~--~---
[Rails-spinoffs] Re: Prototype question....
Guys, clearly Stripe-man is doing his best. Let's try to concentrate on what his real issue is rather than belittling his approach to asking for help, and/or attaching demeaning adjectives to the quality of his work, ok? Stripe... I think it best at this point to provide a live link to a little page isolating the problem. I too, have looked at your files, and at first blush thought it could be solved by Martin's suggestion. I don't run PHP so I can't fire through this stuff without extracting to .html first. On 12/3/06, tobie [EMAIL PROTECTED] wrote: Hi Terry, If you want assistance: 1. explain clearly what you want to do. 2. isolate the issue that is causing problems. 3. provide a link to a test case of that issue. 4. make sure your code and markup are valid. 5. remove anything that is useless or not pertinent to the issue at hand. I'd be most happy to help you once you provide the above. Have you downloaded and used Firebug? Regards, Tobie -- Tobie Langel http://tobielangel.com -- Ryan Gahl Application Development Consultant Athena Group, Inc. Inquire: 1-920-955-1457 Blog: http://www.someElement.com --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~--~~~~--~~--~--~---
[Rails-spinoffs] Re: Prototype question....
Hi Terry, try: Event.addBehavior({ '.navlink:click' : function(event) { new Effect.Highlight(this, { queue: 'end' }); } }); regards, Tobie --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~--~~~~--~~--~--~---
[Rails-spinoffs] Re: Prototype question....
Thanks for replying... Um.. no.. im sorry to report that didnt work :( On 12/3/06, tobie [EMAIL PROTECTED] wrote: Hi Terry, try: Event.addBehavior({ '.navlink:click' : function(event) { new Effect.Highlight(this, { queue: 'end' }); } }); regards, Tobie -- I have learned that you should'nt compare yourself to others - they are more screwed up than you think. ...unknown In the 60's, people took acid to make the world weird. Now the world is weird and people take Prozac to make it normal. ..unknown _ Terry Remsik stripe-man.dyndns.org [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~--~~~~--~~--~--~---
[Rails-spinoffs] Re: Prototype question....
Terry, I'm sorry, but I really don't get what you are trying to do and what doesn't work. Please try to explain what you want to do more clearly. Please post a link with that ONLY. Thanks, Tobie --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~--~~~~--~~--~--~---
[Rails-spinoffs] Re: Prototype question....
Using addBehaviour, you don't need to add an onclick directly to your div html. Instead, try this: THE JAVASCRIPT /* a behaviour class that will handle all the events fro the menu div element */ var menuButtonBehaviour = Behavior.create({ onclick : function(e) { new Effect.Highlight(this.element, { queue: 'end' }); greet2(this.element.id); } }); /* Apply the event classes to the DOM as the elements become ready */ Event.addBehavior({ 'div.navlink' : menuButtonBehaviour , }); THE HTML div id=item1 class=navlink a id=nav1 href=#Link For Page 1/a /div Hope that helps, FA Stripe-man wrote: Tobie... thanks for the reply... 1.What I want to do is:When i click on one of the navigation links on the left: div id=item1 class=navlink onclick=menu_action('item1');greet2(1) a id=nav1 href=#Link For Page 1/a /div I want the div (item1) to highlight Yellow like the main content part of the page does... That all im trying to do... 2. The problem seems to be coming from an improperly called(formatted?) effect behavior: Below is formated as suggested earlier: var menuitem = 'div#' + item + ':click'; Event.addBehavior({ menuitem : function(event) { new Effect.Highlight(this, { queue: 'end' }); } }); Currently I have this wrapped in a JS function because I want to set 'item' dynamically. Item should be the ID of the div that is wrapping the link thats to be clicked. (see above link and div): function menu_action(item){ var menuitem = 'div#' + item + ':click'; Event.addBehavior({ menuitem : function(event) { new Effect.Highlight(this, { queue: 'end' }); } }); } 3.Test case... http://www.brotherstrust.com/stripe-man/Ajax_PageNavUpdated/ 4.I do believe my code is now valid. 5. Useless code.. well I have tried to keep my code fairly clean... though .. comments have been left because.. well .. they help me.. 6. I have just now installed firebug. though it does not seem any more informative than the js debugger.. I hope this is enough info :) Terry On 12/3/06, *tobie* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Hi Terry, If you want assistance: 1. explain clearly what you want to do. 2. isolate the issue that is causing problems. 3. provide a link to a test case of that issue. 4. make sure your code and markup are valid. 5. remove anything that is useless or not pertinent to the issue at hand. I'd be most happy to help you once you provide the above. Have you downloaded and used Firebug? Regards, Tobie -- Tobie Langel http://tobielangel.com In the 60's, people took acid to make the world weird. Now the world is weird and people take Prozac to make it normal. ..unknown _ Terry Remsik stripe-man.dyndns.org http://stripe-man.dyndns.org [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~--~~~~--~~--~--~---
[Rails-spinoffs] Re: Prototype question....
Hi Terry, So a few things: function menu_action(item){ var menuitem = 'div#' + item + ':click'; Event.addBehavior({ -- menuitem : function(event) { new Effect.Highlight(this, { queue: 'end' }); } }); } In the addBehavior method you create an object with properties as functions but in your object you created property called 'menuitem' literally not 'div#item1:click'. So if I had code like: var id = 'matt' var h = { id: function(){ alert(id) } } h.matt() fails h.id() - alerts 'matt' So the nice thing with Event.addBehavior is that it allows you to add behaviors without doing so inline. Setting the onclick property in HTML is duplicating efforts. If you want to keep the code inline but make your html fat, I would say onclick=new Effect.Highlight(this); greet... should work else I would change your id's to 'item_1' that way you could do something like this Event.observe(window, 'load', function(){ Event.addBehavior({ '.navlinks:click' : function(event) { new Effect.Highlight(this, { queue: 'end' }); greet2(this.id.split('_')[1]) } }) }) Good Luck, Matt On Dec 3, 1:25 pm, Stripe-man [EMAIL PROTECTED] wrote: Thanks for replying... Um.. no.. im sorry to report that didnt work :( On 12/3/06, tobie [EMAIL PROTECTED] wrote: Hi Terry, try: Event.addBehavior({ '.navlink:click' : function(event) { new Effect.Highlight(this, { queue: 'end' }); } }); regards, Tobie-- I have learned that you should'nt compare yourself to others - they are more screwed up than you think. ...unknown In the 60's, people took acid to make the world weird. Now the world is weird and people take Prozac to make it normal. ..unknown _ Terry Remsik stripe-man.dyndns.org [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~--~~~~--~~--~--~---
[Rails-spinoffs] Re: Prototype question....
Stripe-man a écrit : I am having problems with : var menuitem = 'div.'+item+':click'; it simply wont work... may someone please tell me what im am doing wrong ? The '.' selector is for classes. If you're going for ID's, use this instead: var menuitem = 'div#' + item + ':click'; -- Christophe Porteneuve a.k.a. TDD [They] did not know it was impossible, so they did it. --Mark Twain Email: [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~--~~~~--~~--~--~---
[Rails-spinoffs] Re: Prototype question....
Thanks so much for your reply... for some reason .. its still not working.. I will provide more info: Ref: this link... div id=item1 class=navlink onclick=menu_action('item1);greet2(1) a id=nav1 href=#Link For Page 1/a /div When clicking on that div (id=item1) should call the function: function menu_action(item){ var menuitem = 'div.' + item + ':click'//This does not work. //var menuitem = 'div#' + item + ':click'; //This does not work :( - same result Event.addBehavior({ // click on the green div (for fun ;-) menuitem : function(event) { new Effect.Highlight(this, { queue: 'end' }); } }); } Normally.. you use this...and the CLASS name is feed into this arguement... ( 'div.example:click' ) Event.addBehavior({ // click on the green div (for fun ;-) 'div.example:click' : function(event) { new Effect.Highlight(this, { queue: 'end' }); } }); But I need the documentID to be feed into this... Is this possible? On 12/2/06, Christophe Porteneuve [EMAIL PROTECTED] wrote: Stripe-man a écrit : I am having problems with : var menuitem = 'div.'+item+':click'; it simply wont work... may someone please tell me what im am doing wrong ? The '.' selector is for classes. If you're going for ID's, use this instead: var menuitem = 'div#' + item + ':click'; -- Christophe Porteneuve a.k.a. TDD [They] did not know it was impossible, so they did it. --Mark Twain Email: [EMAIL PROTECTED] -- I have learned that you should'nt compare yourself to others - they are more screwed up than you think. ...unknown In the 60's, people took acid to make the world weird. Now the world is weird and people take Prozac to make it normal. ..unknown _ Terry Remsik stripe-man.dyndns.org [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~--~~~~--~~--~--~---
[Rails-spinoffs] Re: Prototype question....
Stripe-man a écrit : onclick=menu_action('item1);greet2(1) Look at your quoting: the closing single quote is missing after 'item1... Your JS is invalid and compensated, in a half-assed way, by the browser. -- Christophe Porteneuve a.k.a. TDD [They] did not know it was impossible, so they did it. --Mark Twain Email: [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~--~~~~--~~--~--~---
[Rails-spinoffs] Re: Prototype question....
Thanks yet again for reply.. (especially so fast..) BTW the effects im trying to use are from the effects.js from prototype Sorry about that.. it was a typo because i had to correct what i had pasted in .. should look like this: div id=item1 class=navlink onclick=menu_action('item1');greet2(1) a id=nav1 href=#Link For Page 1/a /div Thanks for catching that. Issue remains .. Terry On 12/2/06, Christophe Porteneuve [EMAIL PROTECTED] wrote: Stripe-man a écrit : onclick=menu_action('item1);greet2(1) Look at your quoting: the closing single quote is missing after 'item1... Your JS is invalid and compensated, in a half-assed way, by the browser. -- Christophe Porteneuve a.k.a. TDD [They] did not know it was impossible, so they did it. --Mark Twain Email: [EMAIL PROTECTED] -- I have learned that you should'nt compare yourself to others - they are more screwed up than you think. ...unknown In the 60's, people took acid to make the world weird. Now the world is weird and people take Prozac to make it normal. ..unknown _ Terry Remsik stripe-man.dyndns.org [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~--~~~~--~~--~--~---
[Rails-spinoffs] Re: Prototype question....
On 12/1/06, Stripe-man [EMAIL PROTECTED] wrote: function menu_action(item){ var menuitem = 'div.'+item+':click'; Event.addBehavior({ // click on the green div (for fun ;-) menuitem : function(event) { new Effect.Highlight(this, { queue: 'end' }); } }); } This does not work, as { foo: bar } equals { foo: bar}. The property part of the object literal does not get extrapolated. Event.addBehavior({ // click on the green div (for fun ;-) 'div#'+item+':click' : function(event) { new Effect.Highlight(this, { queue: 'end' }); } }); should do it. --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~--~~~~--~~--~--~---
[Rails-spinoffs] Re: Prototype question....
tobie wrote: Hi Stripe-man, I think your error lies here: a id=nav1 href=#Link For Page 1/a Your id is not escaped. It doesn't have to be escaped to be valid HTML. In certain cases, authors may specify the value of an attribute without any quotation marks. The attribute value may only contain letters (a-z and A-Z), digits (0-9), hyphens (ASCII decimal 45), periods (ASCII decimal 46), underscores (ASCII decimal 95), and colons (ASCII decimal 58). We recommend using quotation marks even when it is possible to eliminate them. URL: http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.2 [...] May I suggest that in the future you validate your XHTML (using http://validator.w3.org/ for example) A good suggestion, but who mentioned XHTML? The OP didn't mention it, the vast majority of pages claiming to be XHTML on the web are served as HTML, I've yet to hear a valid reason for its use. To the OP: use HTML 4.01 strict, validate your markup, qoute attributes - it's usually required and always good practice. -- Fred --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~--~~~~--~~--~--~---
[Rails-spinoffs] Re: Prototype question....
On Dec 2, 11:02 pm, Stripe-man [EMAIL PROTECTED] wrote: The suggestion didnt work. Please advise... I had a quick glance at the files you've sent. Although it's spaghetti and I didn't even get the slightest idea what you're trying to accomplish, I have an advice for you: Be more clear about what you're doing. Use Firefox with Firebug and log stuff what happen with console.log(). When you supply examples or example files, please keep them minimal, and don't require us to run PHP to see it. Also, maybe you should take it slowly - the learning curve of JavaScript is not so flat and trying to pack a single page with as many features and effects as you can isn't going to get you somewhere real quick... instead, it'll get you nowhere real slow. -- Mislav --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~--~~~~--~~--~--~---
[Rails-spinoffs] Re: Prototype question....
Fred wrote: It doesn't have to be escaped to be valid HTML. In certain cases, authors may specify the value of an attribute without any quotation marks. The attribute value may only contain letters (a-z and A-Z), digits (0-9), hyphens (ASCII decimal 45), periods (ASCII decimal 46), underscores (ASCII decimal 95), and colons (ASCII decimal 58). We recommend using quotation marks even when it is possible to eliminate them. Well, as we don't know whether he is using XHTML or HTML, suggesting he puts quotes around his attribute values is a good start as in XHTML, All attribute values must be quoted, even those which appear to be numeric. (http://www.w3.org/TR/xhtml1/#h-4.4) --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~--~~~~--~~--~--~---
[Rails-spinoffs] Re: Prototype question regarding Form.Element.EventObserver
Hey there, [EMAIL PROTECTED] a écrit : form select id=id1 optionA/option optionB/option Use value attributes in there. See below. /select /form div id=id2/div Lose the extra quote, too. Won't imped 'cuz the browser is forgiving, but still. Your issue lies with Prototype 1.4 code not dealing properly with unspecified value attributes for select: opt = element.options[index]; value = opt.value; if (!value !('value' in opt)) value = opt.text; You see, a non-specified value attribute yields value == '', which bool-equates to false. But the subtest ('value' in opt) will always be true, as the DOM node *always* features this property. So you never revert back to opt.text. As both your options yield the same value (''), there's no change detected by the Observer. I suggest getting Prototype from the trunk (or if you're not keen on SVN, just get script.aculo.us and snatch its prototype.js file) for now, which deals with missing values. I also submitted a patch recently for ol' bug #5033 [1], that distinguishes between unspecified attribute and empty-valued attribute. But that's not necessary for you: use non-empty value attributes, and use a more recent prototype.js file. [1] http://dev.rubyonrails.org/ticket/5033 -- Christophe Porteneuve aka TDD [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs -~--~~~~--~~--~--~---
[Rails-spinoffs] Re: Prototype question regarding Form.Element.EventObserver
Christophe Porteneuve wrote: Hey there, [EMAIL PROTECTED] a écrit : form select id=id1 optionA/option optionB/option Use value attributes in there. See below. /select /form div id=id2/div Lose the extra quote, too. Won't imped 'cuz the browser is forgiving, but still. Your issue lies with Prototype 1.4 code not dealing properly with unspecified value attributes for select: opt = element.options[index]; value = opt.value; if (!value !('value' in opt)) value = opt.text; You see, a non-specified value attribute yields value == '', which bool-equates to false. But the subtest ('value' in opt) will always be true, as the DOM node *always* features this property. So you never revert back to opt.text. As both your options yield the same value (''), there's no change detected by the Observer. I suggest getting Prototype from the trunk (or if you're not keen on SVN, just get script.aculo.us and snatch its prototype.js file) for now, which deals with missing values. I also submitted a patch recently for ol' bug #5033 [1], that distinguishes between unspecified attribute and empty-valued attribute. But that's not necessary for you: use non-empty value attributes, and use a more recent prototype.js file. [1] http://dev.rubyonrails.org/ticket/5033 indeed not using value attribute there was the cause of it in IE. thanks you for helping me all along. you made me want to learn javascript now :-) -- Christophe Porteneuve aka TDD [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs -~--~~~~--~~--~--~---
[Rails-spinoffs] Re: Prototype question regarding Form.Element.EventObserver
Hey there, [EMAIL PROTECTED] a écrit : thanks everyone, i got it working under Firefox. however, it doesn't do anything in IE ( i am testing it under 6.0) . i am using Sonny's example. script type=text/javascript new Form.Element.EventObserver( 'id1',function(ele,value){ $('id2').innerHTML=test; } ); /script Well, first, onChange is not always triggered at the same time, depending on the browser. Some of those require that the component loses focus. Try that. Also, consider switching from .innerHTML = x to .update(x), which is more portable. Finally, if this doesn't cut it still, consider moving to a regular Observer, which is time-based, with, say, a half-second period. This will be slightly more resource-hungry, but ensures a value change is detected quickly enough. -- Christophe Porteneuve a.k.a. TDD [They] did not know it was impossible, so they did it. --Mark Twain Email: [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs -~--~~~~--~~--~--~---
[Rails-spinoffs] Re: Prototype question regarding Form.Element.EventObserver
Christophe Porteneuve wrote: Hey there, [EMAIL PROTECTED] a écrit : thanks everyone, i got it working under Firefox. however, it doesn't do anything in IE ( i am testing it under 6.0) . i am using Sonny's example. script type=text/javascript new Form.Element.EventObserver( 'id1',function(ele,value){ $('id2').innerHTML=test; } ); /script Well, first, onChange is not always triggered at the same time, depending on the browser. Some of those require that the component loses focus. Try that. tried lose the focus, nothing. by the way, the prototype site mentioned that it support IE 6 above, i guess it is not really the case ? Also, consider switching from .innerHTML = x to .update(x), which is more portable. thanks, applied. Finally, if this doesn't cut it still, consider moving to a regular Observer, which is time-based, with, say, a half-second period. This will be slightly more resource-hungry, but ensures a value change is detected quickly enough. doesn't work either.. here is what i have. html head script type=text/javascript src=prototype.js/script /head body form select id=id1 optionA/option optionB/option /select /form div id=id2/div script type=text/javascript new Form.Element.Observer( 'id1', 0.5, getHTML ); function getHTML(ele, val) { Element.update(id2,val); } /script /body /html -- Christophe Porteneuve a.k.a. TDD [They] did not know it was impossible, so they did it. --Mark Twain Email: [EMAIL PROTECTED] J. --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs -~--~~~~--~~--~--~---
[Rails-spinoffs] Re: Prototype question regarding Form.Element.EventObserver
thanks everyone, i got it working under Firefox. however, it doesn't do anything in IE ( i am testing it under 6.0) . i am using Sonny's example. J. Sonny Savage wrote: The Javascript needs to execute after you define the element. You were trying to reference 'id2' before it existed. html head script type=text/javascript src=prototype.js/script /head body form select id=id1 option value=A/option optionB/option /select /form div id=id2/div script type=text/javascript new Form.Element.EventObserver( 'id1',function(ele,value){ $('id2').innerHTML=test; } ); /script /body /html --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs -~--~~~~--~~--~--~---
[Rails-spinoffs] Re: Prototype question regarding Form.Element.EventObserver
Almost :) To quote Martin, Execution of JS code happens as the HTMl file is parsed. The time this code is executed, there is no id2 element in the DOM. You have to put the script block containing the EventObserver call _after_ you define the select element. Just move the script block right after the / form closing tag or so. -Thomas Am 23.10.2006 um 23:42 schrieb [EMAIL PROTECTED]: thanks for the reply. however, this doesn't work either.. seems to be loading forever. probably some dumb mistake i made but i just can't see it now.. :-( html head script type=text/javascript src=prototype.js/script /head body script type=text/javascript new Form.Element.EventObserver( 'id1',function(ele,value){ $('id2').innerHTML=test; } ); /script form select id=id1 option value=A/option optionB/option /select /form div id=id2/div /body /html -- Thomas Fuchs wollzelle http://www.wollzelle.com questentier on AIM madrobby on irc.freenode.net http://www.fluxiom.com :: online digital asset management http://script.aculo.us :: Web 2.0 JavaScript http://mir.aculo.us :: Where no web developer has gone before --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs -~--~~~~--~~--~--~---
[Rails-spinoffs] Re: Prototype question regarding Form.Element.EventObserver
The _javascript_ needs to execute after you define the element. You were trying to reference 'id2' before it existed.htmlhead script type=text/_javascript_ src="">/headbody formselect id=id1 option value=A/option optionB/option/select/form div id=id2/divscript type=text/_javascript_new Form.Element.EventObserver( 'id1',function(ele,value){ $('id2').innerHTML=test; } );/script/body/htmlOn 10/23/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: thanks for the reply. however, this doesn't work either.. seems to beloading forever. probably some dumb mistake i made but i just can't seeit now.. :-(htmlheadscript type=text/_javascript_ src="" prototype.js/script/headbodyscript type=text/_javascript_new Form.Element.EventObserver( 'id1',function(ele,value){$('id2').innerHTML=test;} ); /scriptformselect id=id1 option value=A/optionoptionB/option/select/formdiv id=id2/div /body/html --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs -~--~~~~--~~--~--~---
[Rails-spinoffs] Re: Prototype question regarding Form.Element.EventObserver
On 10/23/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: in header, i have script type=text/javascript new Form.Element.EventObserver(id1, function(ele,value){ $('id2').innerHTML=bal} ); /script Execution of JS code happens as the HTMl file is parsed. The time this code is executed, there is no id2 element in the DOM. --~--~-~--~~~---~--~~ 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@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs -~--~~~~--~~--~--~---