Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

javascript - help me wrap up a slider into a function I can call -


a while ago posted question jquery slider here

this works treat need wrap in function each day of week can pass in values of values hard coded. i've tried doing , firebugs telling me slider undefined.

all want call function 7 times each day of week , pass in id slider, id div holds times, id div holds generated table, id table , id button.

the current code this:

var starttime; var endtime;  $("#slider-range").slider({     range: true, min: 0, max: 1439, values: [540, 1020], step:5, slide: slidetime, /*change: */}); function slidetime(event, ui){     var minutes0 = parseint($("#slider-range").slider("values", 0) % 60);     var hours0 = parseint($("#slider-range").slider("values", 0) / 60 % 24);     var minutes1 = parseint($("#slider-range").slider("values", 1) % 60);     var hours1 = parseint($("#slider-range").slider("values", 1) / 60 % 24);     starttime = gettime(hours0, minutes0);     endtime = gettime(hours1, minutes1);     $("#time").html('<p>opening time: ' + starttime + '</p><p>closing time: ' + endtime + '</p>'); function gettime(hours, minutes) {     minutes = minutes + "";     if (hours == 12) {     hours = 12; } if (hours > 12) {     hours = hours; } if (minutes.length == 1) {     minutes = "0" + minutes; } return hours + ":" + minutes ;  function gettimeloop(minutesloop) {     minutesloop = minutesloop + "";     if (minutesloop.length == 1) {         minutesloop = "0" + minutesloop;     } returnminuetsloop; }                                   }                                            slidetime();                                         $('#btnupdatetable').click(function(){ var startloop = parseint($("#slider-range").slider("values", 0)); var endloop = parseint($("#slider-range").slider("values", 1)); $('#bookingtimestable').remove(); $('<table id="bookingtimestable">').appendto('#generatedresulttable'); for(i = startloop; < endloop; i+=5) { $('<tr><td style="width:145px; padding-left: 10px;">' + parseint(i/ 60 % 24) + ':' +  gettimeloop(parseint(i % 60)) + '</td><td style="padding-left: 10px;" ><input class="chx" name="' + parseint(i/ 60 % 24) + ':' +  gettimeloop(parseint(i % 60)) + '" type="checkbox" value="' + parseint(i/ 60 % 24) + ':' +  gettimeloop(parseint(i % 60)) + '" /></td></tr>').appendto('#bookingtimestable'); } var i=0; var period = $('#cbobooking').val();          $('.chx').each(function(){   $(this).attr('checked',(i % period ==0));   i++; }); $('#bookingtimestable tr:odd').css('background','#dedede'); });  

if me on great! being implemented 7 days of week on tabbed interface , want , running fast

dan

just quick note of assistance... wrap entire thing in constructor function, form closure upon of contained variables , functions. pass in redefine function arguments:

function bookingslider (sliderid, timesdivid, tabledivid, tableid, buttonid) {     // code } 

use constructor instantiate new instances of bookingslider, passing in appropriate values:

var bsmonday = new bookingslider('slider-range', 'time', 'generatedresulttable', 'bookingtimestable', 'btnupdatetable'); 

make sure substitute string constants appropriate arguments in function:

'#btnupdatetable' 

becomes

'#' + buttonid 

Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -