yes thank you very much ,yes there is no need of thoose function now
On Jul 15, 3:41 pm, machineghost <[EMAIL PROTECTED]> wrote:
> >addElementClass(close_run_btn, 'hidden');
>
> This line is basically the same as saying:
> close_run_btn.classNames += " hidden";
>
> >removeElementClass(close_info_div, 'hidden');
>
> This line uses a method that is the reverse of the last one:
> close_info_div.classNames.replace("hidden", "");
>
> >findChildElements(close_info_div, ["input"])[0].focus()
>
> This line could be split in to two:
> var childElements = findChildElements(close_info_div, ["input"]);
> childElements[0].focus();
> and then you could replace the first line with something like:
> var childElements = close_info_div.childNodes;
> var inputChildElements = [];
> for(var i = 0; i < childElements.length; i++) {
> if(childElements[i].tagName == "input")
> inputChildElements.append(childElements[i];
> }
> childElements = inputChildElements;
>
> So, in other words, line 1 adds the "hidden" class to close_run_btn.
> Line 2 removes that same class from close_info_div. Line 3 finds
> changes the browser's focus to the first INPUT element that is a child
> of close_info_div. If you wanted to add "go back" functionality to
> you're code, you'd just need to do:
>
> connect(close_btn, 'onclick', function(){
> addElementClass(close_run_btn, 'hidden');
> removeElementClass(close_info_div, 'hidden');
> findChildElements(close_info_div, ["input"])[0].focus();
> history.back();
>
> });
>
> But that would be sort of silly; what's the point of adding/removing
> classes and changing the focus if you're just going to send the user
> to a different page?
>
> Hope that helps.
>
> Jeremy
>
> On Jul 14, 8:12 am, anna1980 <[EMAIL PROTECTED]> wrote:
>
> > hi
> > i'm working in application which use the library Mochikit; what i need
> > to do is adding one function to one button to make him also go back
> > to page the user come from (something like history.go(-1))
> > the button is:
> > close_btn = SPAN({"class": "button close_run"}, "bouton1"),
>
> > and what he is doing now is this:
>
> > connect(close_btn, 'onclick', function(){
> > addElementClass(close_run_btn, 'hidden');
> > removeElementClass(close_info_div, 'hidden');
> > findChildElements(close_info_div, ["input"])
> > [0].focus();
> > });
> > actually i don't understand what he is doing now to be able to add
> > other function.
> > can somebody help me to understand better
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"MochiKit" 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/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---