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 [email protected]
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
-~----------~----~----~----~------~----~------~--~---