can someone show me how to call two functions at the same time... and is it possible calling them with the onShow command? thanks

Recommended Answers

All 3 Replies

you can't call two functions at the same time, but why would you want to? You can just have them execute one by one. The browser executes the functions fast enough anyway so you won't notice any difference :)

If your problem has been solved, please also mark the thread as solved :)

oh sorry haven't check daniweb for today, thanks for your reply though can you help me about my problem. I have a js file and these are the codes I need to call at the same time or the one that you said about calling one at a time, it's for a datepicker so they could be running in one datepicker

Code 1:

selectColumn: function(picker, inst) {
           var target = $(this);
           picker.find('div.datepick-month th span').each(function() {
               $('<a href="javascript:void(0)" class="' +
                       this.className + '" title="Select all of these days">' +
                       $(this).text() + '</a>').
                   click(function() {
                       var dates = $('div.datepick-month td:nth-child(' +
                           ($(this).parent().index() + 1) +
                           ') a:not(.datepick-other-month)', picker);
                       dates = dates.map(function(i, elem) {
                           return target.datepick('retrieveDate', this);
                       }).get();
                       //target.datepick('clear').datepick('setDate', dates);
					   $.merge(dates, target.datepick('getDate'));
					   target.datepick('clear').datepick('setDate', dates);
                   }).
                   replaceAll(this);
           });
       },

Code 2:

selectWeek: function(picker, inst) {
		var target = $(this);
		picker.find('td.datepick-week span').each(function() {
			$('<a href="javascript:void(0)" class="' +
					this.className + '" title="Select the entire week">' +
					$(this).text() + '</a>').
				click(function() {
					var date = target.datepick('retrieveDate', this);
					var dates = [date];
					for (var i = 1; i < 7; i++) {
						dates.push(date = $.datepick.add($.datepick.newDate(date), 1, 'd'));
					}
					if (inst.get('rangeSelect')) {
						dates.splice(1, dates.length - 2);
					}
					target.datepick('setDate', dates).datepick('hide');
				}).
				replaceAll(this);
		});
	},

and from my main page:

$('#selectWeekPicker').datepick({ 
    //renderer: $.datepick.weekOfYearRenderer, 
    firstDay: 1, showOtherMonths: true, //rangeSelect: true, 
    onShow: $.datepick.selectColumn, multiSelect: 999, multiSeparator: ', ', showTrigger: '#calImg'});
});

what am I doing wrong, oh for the renderer here's the code:

$.extend($.datepick, {

	// Template for generating a datepicker showing week of year.
	weekOfYearRenderer: $.extend({}, $.datepick.defaultRenderer, {
		weekHeader: '<tr><th class="datepick-week">' +
		'<span title="{l10n:weekStatus}">{l10n:weekText}</span></th>{days}</tr>',
		week: '<tr><td class="datepick-week">{weekOfYear}</td>{days}</tr>'
	}),

hope you could help me sir, Code 2 needs to have the renderer command to work, so how will I call them to my main page?

Thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.