
|
[dokuwiki]
||
[Date Prev]
[08-2006 Date Index]
[Date Next]
||
[Thread Prev]
[08-2006 Thread Index]
[Thread Next]
[dokuwiki] [OFFTOPIC] odd addEvent problem
- From: Michael Klier <chi@xxxxxxxxxxx>
- To: dokuwiki@xxxxxxxxxxxxx
- Date: Tue, 1 Aug 2006 18:21:26 +0200
Hi folks,
sorry for this totally dokuwiki unrelated post but maybe one of you can
help me.
I am currently working on a calendar plugin for dokuwiki (again...).
This plugin has a toolbar with several buttons (in their own forms) to
switch the calendar view (week/month/year). I like to do this
view-switching thing via ajax. Therefore I call a JS function
addToolEvents() via the addInitEvent() in order to attach an event
to each of these buttons.
addInitEvent(
function() {
calendar.attachToolEvents($('plugin_calendar_tools'));
}
);
the attachToolEvents() function looks like this:
calendar = {
...
attachToolEvents: function(obj) {
if(!obj) return;
var argv = '';
var button = '';
var arg = [];
// attach toolbar buttons
var tool_btns = getElementsByClass('cal_tool_btn',obj,'form');
if(tool_btns) {
for(var i=0;i<tool_btns.length;i++) {
argv = '';
button = getElementsByClass('button',tool_btns[i],'input')[0];
arg = getElementsByClass('arg',tool_btns[i],'input');
for(var j=0;j<arg.length;j++) {
argv += arg[j].name + '=' + arg[j].value + '&';
}
// add calendar namespace to argument list
argv += 'cal_ns=' + calendar.calNS;
// attach the Event
addEvent(button,'click',function() { return
calendar.show(argv); });
}
}
},
...
};
The odd thing is that every Button gets the arguments of the last button
attached, so clicking on any of these buttons results in the same action.
I really don`t know why this is happening. I use a more ore less equal
function in another place and have no problems there :-?. I have
checked so far:
- that I have no JS Errors in Firefox JS-Console
- that the objects returned by getElementsByClass() are the right
ones
- that argv has the right values for every button
Any feedback on this would be highly appreciated :-).
Thanks in advance.
Michael
--
Michael Klier
mail: chi@xxxxxxxxxxx
www: http://www.chimeric.de
icq: 206179334
jabber: chi@xxxxxxxxxxxxx
key: http://downloads.chimeric.de/chi.asc
key-id: 0x8308F551
|

|