Thursday, June 2, 2011

jquery select row , column matrix - Version 1

Selecting row, columns of a Matrix in jquery version one.

Click here to see the Demo. [ Note the javascript is having lot of repeated code version two will be posted soon with reduce no of lines of javascipt code]

Range can be selected with values in the From , To input box some sample inputs are

1. From a1 To p25
2. From b1 To b15
3. From a10 To a15
4. From a1 To p24
5. From d9 To k 15

From input box should have alphabet values less than To input box alphabet.
Also From input box numeric value should be less than or equal to To input box numeric value.

Screen shot of the demo






HTML Code

<div class="top_adj1 lft"> <span>From</span><input type="text" id="fromVal" /> <span>To</span><input type="text" id="toVal" /> <input type="button" id="btnClick" value="Submit" /> </div> <br /> <p> <input type="checkbox" id="selAll" />Select All <input type="checkbox" id="selFirstQuarter" />Select 1st Qtr <input type="checkbox" id="selSecondQuarter" />Select 2nd Qtr <input type="checkbox" id="selThirdQuarter" />Select 3rd Qtr <input type="checkbox" id="selFourthQuarter" />Select 4th Qtr </p> <div class="sourceplate1 top_adj1 lft"> <ul> <li></li> <li>1</li><li>2</li><li>3</li><li>4</li><li>5</li><li>6</li><li>7</li><li>8</li><li>9</li><li>10</li><li>11</li><li>12</li> <li>13</li><li>14</li><li>15</li><li>16</li><li>17</li><li>18</li><li>19</li><li>20</li><li>21</li><li>22</li><li>23</li><li>24</li> </ul> </div> <div class="sourceplate"> <ul> <li>A</li> <li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li> <li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li> <li>B</li> <li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li> <li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li> <li>C</li> <li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li> <li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li> <li>D</li> <li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li> <li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li> <li>E</li> <li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li> <li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li> <li>F</li> <li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li> <li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li> <li>G</li> <li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li> <li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li> <li>H</li> <li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li> <li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li> <li>I</li> <li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li> <li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li> <li>J</li> <li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li> <li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li> <li>K</li> <li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li> <li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li> <li>L</li> <li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li> <li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li> <li>M</li> <li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li> <li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li> <li>N</li> <li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li> <li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li> <li>O</li> <li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li> <li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li> <li>P</li> <li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li> <li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li><li></li> </ul> </div>

Place the Javascript code inside script tags, and place in Head section of the HTML page.

<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.4.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
 var options   
 options =  $(".sourceplate li");

 $("#selFirstQuarter").click(function()
 {
  if($(this).is(':checked'))
  {
   options.slice(0,401).removeClass("selected");
   $('#selAll').attr('checked', false);
   $('#selSecondQuarter').attr('checked', false);
   $('#selThirdQuarter').attr('checked', false);
   $('#selFourthQuarter').attr('checked', false);
   recFunction(1,12,8);
  }
  else
  {
   options.slice(0,401).removeClass("selected");
  } 
 })

 $("#selSecondQuarter").click(function()
 {
  if($(this).is(':checked'))
  {
   options.slice(0,401).removeClass("selected");
   $('#selAll').attr('checked', false);
   $('#selFirstQuarter').attr('checked', false);
   $('#selThirdQuarter').attr('checked', false);
   $('#selFourthQuarter').attr('checked', false);
   recFunction(13,24,8);
  }
  else
  {
   options.slice(0,401).removeClass("selected");
  } 
 })

 $("#selThirdQuarter").click(function()
 {
  if($(this).is(':checked'))
  {
   options.slice(0,401).removeClass("selected");
   $('#selAll').attr('checked', false);
   $('#selFirstQuarter').attr('checked', false);
   $('#selSecondQuarter').attr('checked', false);
   $('#selFourthQuarter').attr('checked', false);
   recFunction(201,212,8);
  }
  else
  {
   options.slice(0,401).removeClass("selected");
  } 
 })

 $("#selFourthQuarter").click(function()
 { 
  if($(this).is(':checked'))
  {
   options.slice(0,401).removeClass("selected");
   $('#selAll').attr('checked', false);
   $('#selFirstQuarter').attr('checked', false);
   $('#selSecondQuarter').attr('checked', false);
   $('#selThirdQuarter').attr('checked', false);
   recFunction(213,224,8);
  }
  else
  {
   options.slice(0,401).removeClass("selected");
  } 
 })
  
 $("#selAll").click(function()
 { 
  if($(this).is(':checked'))
  {
   $('#selFirstQuarter').attr('checked', false);
   $('#selSecondQuarter').attr('checked', false);
   $('#selThirdQuarter').attr('checked', false);
   $('#selFourthQuarter').attr('checked', false);
   options.slice(0,401).addClass("selected")
  }
  else
  {
   options.slice(0,401).removeClass("selected")
  }  
   
  removeFirstColBgStyle();
 })

 $(".sourceplate li").click(function()
 {
  $(".sourceplate li").eq($(this).index()).toggleClass("selected");  
  removeFirstColBgStyle();  
 });

 $("#btnClick").click(function(event)
 {
  var tempfrm
  var tempto 
  var tempfrmAlpha
  var temptoAlpha 
  var frmValStr 
  var toValStr 
  var frmVal
  var toVal 
  
  var fromAlphaArray=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p"];
  var toAlphaArray=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p"];   

  options.slice(0,401).removeClass("selected"); 
  
  frmValStr = $("#fromVal").val();
  toValStr = $("#toVal").val();
  
  frmVal = parseInt($("#fromVal").val());
  toVal = parseInt($("#toVal").val())+1;        
  
  tempfrm = frmValStr.substring(1, frmValStr.length );
  tempto = toValStr.substring(1, toValStr.length );

  tempfrmAlpha = frmValStr.substring(0, 1);
  temptoAlpha = toValStr.substring(0, 1);
  
  
  if (tempfrmAlpha == "b"){tempfrm = parseInt(tempfrm) + 25;}
  if (tempfrmAlpha == "c"){tempfrm = parseInt(tempfrm)  + 50;}
  if (tempfrmAlpha == "d"){tempfrm = parseInt(tempfrm) + 75;}
  if (tempfrmAlpha == "e"){tempfrm = parseInt(tempfrm)  + 100;}
  if (tempfrmAlpha == "f"){tempfrm = parseInt(tempfrm) + 125;}
  if (tempfrmAlpha == "g"){tempfrm = parseInt(tempfrm) + 150;}
  if (tempfrmAlpha == "h"){tempfrm = parseInt(tempfrm)  + 175;}
  if (tempfrmAlpha == "i"){tempfrm = parseInt(tempfrm) + 200;}  
  if (tempfrmAlpha == "j"){tempfrm = parseInt(tempfrm) + 225;}
  if (tempfrmAlpha == "k"){tempfrm = parseInt(tempfrm) + 250;}  
  if (tempfrmAlpha == "l"){tempfrm = parseInt(tempfrm) + 275;}
  if (tempfrmAlpha == "m"){tempfrm = parseInt(tempfrm) + 300;}
  if (tempfrmAlpha == "n"){tempfrm = parseInt(tempfrm) + 325;}  
  if (tempfrmAlpha == "o"){tempfrm = parseInt(tempfrm) + 350;}
  if (tempfrmAlpha == "p"){tempfrm = parseInt(tempfrm) + 375;}   
  
  if (temptoAlpha == "b"){tempto = parseInt(tempto)  + 25;}
  if (temptoAlpha == "c"){tempto = parseInt(tempto)  + 50;}
  if (temptoAlpha == "d"){tempto = parseInt(tempto)+ 75;}
  if (temptoAlpha == "e"){tempto = parseInt(tempto)+ 100;}
  if (temptoAlpha == "f"){tempto = parseInt(tempto)+ 125;}
  if (temptoAlpha == "g"){tempto = parseInt(tempto)+ 150;}
  if (temptoAlpha == "h"){tempto = parseInt(tempto)+ 175;}
  if (temptoAlpha == "i"){tempto = parseInt(tempto)+ 200;}  
  if (temptoAlpha == "j"){tempto = parseInt(tempto)+ 225;}
  if (temptoAlpha == "k"){tempto = parseInt(tempto)+ 250;}  
  if (temptoAlpha == "l"){tempto = parseInt(tempto)+ 275;}
  if (temptoAlpha == "m"){tempto = parseInt(tempto)+ 300;}
  if (temptoAlpha == "n"){tempto = parseInt(tempto)+ 325;}  
  if (temptoAlpha == "o"){tempto = parseInt(tempto)+ 350;}
  if (temptoAlpha == "p"){tempto = parseInt(tempto)+ 375;} 

/*  for (i=1;i< fromAlphaArray.length;i++)
  {
   if(tempfrmAlpha == fromAlphaArray[i]){tempfrm = parseInt(tempfrm) + i * 25;}
  }  

  for (i=1;i< toAlphaArray.length;i++)
  {
   if(temptoAlpha == toAlphaArray[i]){tempto = parseInt(tempto)  + i * 25;}   
  } */ 
  
  
  tempto  = parseInt(tempto); 
  tempfrm = parseInt(tempfrm);
  //alert(tempfrm + ' - ' + tempto);
  for (i=tempfrm;i<tempto+1;i++)
  {
   //if(tempfrmAlpha == temptoAlpha){options.slice(tempfrm,tempto+1).css("background","yellow");break;}
   if(tempfrmAlpha == temptoAlpha){options.slice(tempfrm,tempto + 1 ).addClass("selected");break;}


   ///////////////////////////////////////////// Starging from b /////////////////////////////////////////////
   if (tempfrmAlpha == "b")
   {
    if (temptoAlpha == "c"){tempto = tempto -25 ;i=2;}    
    if (temptoAlpha == "d"){tempto = tempto -50 ;i=3;}          
    if (temptoAlpha == "e"){tempto = tempto -75 ;i=4;} 
    if (temptoAlpha == "f"){tempto = tempto -100 ;i=5;}    
    if (temptoAlpha == "g"){tempto = tempto -125 ;i=6;} 
    if (temptoAlpha == "h"){tempto = tempto -150 ;i=7;} 
    if (temptoAlpha == "i"){tempto = tempto -175 ;i=8;}    
    if (temptoAlpha == "j"){tempto = tempto -200 ;i=9;}
    if (temptoAlpha == "k"){tempto = tempto -225 ;i=10;} 
    if (temptoAlpha == "l"){tempto = tempto -250 ;i=11;} 
    if (temptoAlpha == "m"){tempto = tempto -275 ;i=12;} 
    if (temptoAlpha == "n"){tempto = tempto -300 ;i=13;} 
    if (temptoAlpha == "o"){tempto = tempto -325 ;i=14;} 
    if (temptoAlpha == "p"){tempto = tempto -350 ;i=15;}
    
    if (tempfrm == tempto){recFunction(tempfrm,tempto,i);break;}else{recFunction(tempfrm,tempto,i);break;}   
   }   
   ///////////////////////////////////////////// Starging from b /////////////////////////////////////////////

   ///////////////////////////////////////////// Starging from c /////////////////////////////////////////////
   if (tempfrmAlpha == "c")
   {
    if (temptoAlpha == "d"){tempto = tempto -25 ;i=2;}    
    if (temptoAlpha == "e"){tempto = tempto -50 ;i=3;}          
    if (temptoAlpha == "f"){tempto = tempto -75 ;i=4;} 
    if (temptoAlpha == "g"){tempto = tempto -100 ;i=5;}    
    if (temptoAlpha == "h"){tempto = tempto -125 ;i=6;} 
    if (temptoAlpha == "i"){tempto = tempto -150 ;i=7;} 
    if (temptoAlpha == "j"){tempto = tempto -175 ;i=8;}    
    if (temptoAlpha == "k"){tempto = tempto -200 ;i=9;}
    if (temptoAlpha == "l"){tempto = tempto -225 ;i=10;} 
    if (temptoAlpha == "m"){tempto = tempto -250 ;i=11;} 
    if (temptoAlpha == "n"){tempto = tempto -275 ;i=12;} 
    if (temptoAlpha == "o"){tempto = tempto -300 ;i=13;} 
    if (temptoAlpha == "p"){tempto = tempto -325 ;i=14;} 
    
    if (tempfrm == tempto){recFunction(tempfrm,tempto,i);break;}else{recFunction(tempfrm,tempto,i);break;}  
   }   
   ///////////////////////////////////////////// Starging from c /////////////////////////////////////////////


   ///////////////////////////////////////////// Starging from d /////////////////////////////////////////////
   if (tempfrmAlpha == "d")
   {
    if (temptoAlpha == "e"){tempto = tempto -25 ;i=2;}    
    if (temptoAlpha == "f"){tempto = tempto -50 ;i=3;}          
    if (temptoAlpha == "g"){tempto = tempto -75 ;i=4;} 
    if (temptoAlpha == "h"){tempto = tempto -100 ;i=5;}    
    if (temptoAlpha == "i"){tempto = tempto -125 ;i=6;} 
    if (temptoAlpha == "j"){tempto = tempto -150 ;i=7;} 
    if (temptoAlpha == "k"){tempto = tempto -175 ;i=8;}    
    if (temptoAlpha == "l"){tempto = tempto -200 ;i=9;}
    if (temptoAlpha == "m"){tempto = tempto -225 ;i=10;} 
    if (temptoAlpha == "n"){tempto = tempto -250 ;i=11;} 
    if (temptoAlpha == "o"){tempto = tempto -275 ;i=12;} 
    if (temptoAlpha == "p"){tempto = tempto -300 ;i=13;}
    
    if (tempfrm == tempto){recFunction(tempfrm,tempto,i);break;}else{recFunction(tempfrm,tempto,i);break;} 
   }   
   ///////////////////////////////////////////// Starging from d /////////////////////////////////////////////

   ///////////////////////////////////////////// Starging from e /////////////////////////////////////////////
   if (tempfrmAlpha == "e")
   {
    if (temptoAlpha == "f"){tempto = tempto -25 ;i=2;}    
    if (temptoAlpha == "g"){tempto = tempto -50 ;i=3;}          
    if (temptoAlpha == "h"){tempto = tempto -75 ;i=4;} 
    if (temptoAlpha == "i"){tempto = tempto -100 ;i=5;}    
    if (temptoAlpha == "j"){tempto = tempto -125 ;i=6;} 
    if (temptoAlpha == "k"){tempto = tempto -150 ;i=7;} 
    if (temptoAlpha == "l"){tempto = tempto -175 ;i=8;}    
    if (temptoAlpha == "m"){tempto = tempto -200 ;i=9;}
    if (temptoAlpha == "n"){tempto = tempto -225 ;i=10;} 
    if (temptoAlpha == "o"){tempto = tempto -250 ;i=11;} 
    if (temptoAlpha == "p"){tempto = tempto -275 ;i=12;}
    
    if (tempfrm == tempto){recFunction(tempfrm,tempto,i);break;}else{recFunction(tempfrm,tempto,i);break;} 
   }   
   ///////////////////////////////////////////// Starging from e /////////////////////////////////////////////

   ///////////////////////////////////////////// Starging from f /////////////////////////////////////////////
   if (tempfrmAlpha == "f")
   {
    if (temptoAlpha == "g"){tempto = tempto -25 ;i=2;}    
    if (temptoAlpha == "h"){tempto = tempto -50 ;i=3;}          
    if (temptoAlpha == "i"){tempto = tempto -75 ;i=4;} 
    if (temptoAlpha == "j"){tempto = tempto -100 ;i=5;}    
    if (temptoAlpha == "k"){tempto = tempto -125 ;i=6;} 
    if (temptoAlpha == "l"){tempto = tempto -150 ;i=7;} 
    if (temptoAlpha == "m"){tempto = tempto -175 ;i=8;}    
    if (temptoAlpha == "n"){tempto = tempto -200 ;i=9;}
    if (temptoAlpha == "o"){tempto = tempto -225 ;i=10;} 
    if (temptoAlpha == "p"){tempto = tempto -250 ;i=11;}
    
    if (tempfrm == tempto){recFunction(tempfrm,tempto,i);break;}else{recFunction(tempfrm,tempto,i);break;}  
   }   
   ///////////////////////////////////////////// Starging from f /////////////////////////////////////////////

   ///////////////////////////////////////////// Starging from g /////////////////////////////////////////////
   if (tempfrmAlpha == "g")
   {
    if (temptoAlpha == "h"){tempto = tempto -25 ;i=2;}    
    if (temptoAlpha == "i"){tempto = tempto -50 ;i=3;}          
    if (temptoAlpha == "j"){tempto = tempto -75 ;i=4;} 
    if (temptoAlpha == "k"){tempto = tempto -100 ;i=5;}    
    if (temptoAlpha == "l"){tempto = tempto -125 ;i=6;} 
    if (temptoAlpha == "m"){tempto = tempto -150 ;i=7;} 
    if (temptoAlpha == "n"){tempto = tempto -175 ;i=8;}    
    if (temptoAlpha == "o"){tempto = tempto -200 ;i=9;}
    if (temptoAlpha == "p"){tempto = tempto -225 ;i=10;}
    
    if (tempfrm == tempto){recFunction(tempfrm,tempto,i);break;}else{recFunction(tempfrm,tempto,i);break;}   
   }   
   ///////////////////////////////////////////// Starging from g /////////////////////////////////////////////

   ///////////////////////////////////////////// Starging from h /////////////////////////////////////////////
   if (tempfrmAlpha == "h")
   {
    if (temptoAlpha == "i"){tempto = tempto -25 ;i=2;}    
    if (temptoAlpha == "j"){tempto = tempto -50 ;i=3;}          
    if (temptoAlpha == "k"){tempto = tempto -75 ;i=4;} 
    if (temptoAlpha == "l"){tempto = tempto -100 ;i=5;}    
    if (temptoAlpha == "m"){tempto = tempto -125 ;i=6;} 
    if (temptoAlpha == "n"){tempto = tempto -150 ;i=7;} 
    if (temptoAlpha == "o"){tempto = tempto -175 ;i=8;}    
    if (temptoAlpha == "p"){tempto = tempto -200 ;i=9;}
    
    if (tempfrm == tempto){recFunction(tempfrm,tempto,i);break;}else{recFunction(tempfrm,tempto,i);break;}   
   }   
   ///////////////////////////////////////////// Starging from h /////////////////////////////////////////////

   ///////////////////////////////////////////// Starging from i /////////////////////////////////////////////
   if (tempfrmAlpha == "i")
   {
    if (temptoAlpha == "j"){tempto = tempto -25 ;i=2;}    
    if (temptoAlpha == "k"){tempto = tempto -50 ;i=3;}          
    if (temptoAlpha == "l"){tempto = tempto -75 ;i=4;} 
    if (temptoAlpha == "m"){tempto = tempto -100 ;i=5;}    
    if (temptoAlpha == "n"){tempto = tempto -125 ;i=6;} 
    if (temptoAlpha == "o"){tempto = tempto -150 ;i=7;} 
    if (temptoAlpha == "p"){tempto = tempto -175 ;i=8;}
    
    if (tempfrm == tempto){recFunction(tempfrm,tempto,i);break;}else{recFunction(tempfrm,tempto,i);break;}    
   }   
   ///////////////////////////////////////////// Starging from i /////////////////////////////////////////////

   ///////////////////////////////////////////// Starging from j /////////////////////////////////////////////
   if (tempfrmAlpha == "j")
   {
    if (temptoAlpha == "k"){tempto = tempto -25 ;i=2;}    
    if (temptoAlpha == "l"){tempto = tempto -50 ;i=3;}          
    if (temptoAlpha == "m"){tempto = tempto -75 ;i=4;} 
    if (temptoAlpha == "n"){tempto = tempto -100 ;i=5;}    
    if (temptoAlpha == "o"){tempto = tempto -125 ;i=6;} 
    if (temptoAlpha == "p"){tempto = tempto -150 ;i=7;}
    
    if (tempfrm == tempto){recFunction(tempfrm,tempto,i);break;}else{recFunction(tempfrm,tempto,i);break;}
   }   
   ///////////////////////////////////////////// Starging from j /////////////////////////////////////////////

   ///////////////////////////////////////////// Starging from k /////////////////////////////////////////////
   if (tempfrmAlpha == "k")
   {
    if (temptoAlpha == "l"){tempto = tempto -25 ;i=2;}    
    if (temptoAlpha == "m"){tempto = tempto -50 ;i=3;}          
    if (temptoAlpha == "n"){tempto = tempto -75 ;i=4;} 
    if (temptoAlpha == "o"){tempto = tempto -100 ;i=5;}    
    if (temptoAlpha == "p"){tempto = tempto -125 ;i=6;}
    
    if (tempfrm == tempto){recFunction(tempfrm,tempto,i);break;}else{recFunction(tempfrm,tempto,i);break;}    
   }   
   ///////////////////////////////////////////// Starging from k /////////////////////////////////////////////

   ///////////////////////////////////////////// Starging from L /////////////////////////////////////////////
   if (tempfrmAlpha == "l")
   {
    if (temptoAlpha == "m"){tempto = tempto -25 ;i=2;}    
    if (temptoAlpha == "n"){tempto = tempto -50 ;i=3;}          
    if (temptoAlpha == "o"){tempto = tempto -75 ;i=4;} 
    if (temptoAlpha == "p"){tempto = tempto -100 ;i=5;}
    
    if (tempfrm == tempto){recFunction(tempfrm,tempto,i);break;}else{recFunction(tempfrm,tempto,i);break;}   
   }   
   ///////////////////////////////////////////// Starging from L /////////////////////////////////////////////

   ///////////////////////////////////////////// Starging from m /////////////////////////////////////////////
   if (tempfrmAlpha == "m")
   {
    if (temptoAlpha == "n"){tempto = tempto -25 ;i=2;}    
    if (temptoAlpha == "o"){tempto = tempto -50 ;i=3;}          
    if (temptoAlpha == "p"){tempto = tempto -75 ;i=4;}
    
    if (tempfrm == tempto){recFunction(tempfrm,tempto,i);break;}else{recFunction(tempfrm,tempto,i);break;}
    
   }   
   ///////////////////////////////////////////// Starging from m /////////////////////////////////////////////

   ///////////////////////////////////////////// Starging from n /////////////////////////////////////////////
   if (tempfrmAlpha == "n")
   {
    if (temptoAlpha == "o"){tempto = tempto -25 ;i=2;}    
    if (temptoAlpha == "p"){tempto = tempto -50 ;i=3;}
    
    if (tempfrm == tempto){recFunction(tempfrm,tempto,i);break;}else{recFunction(tempfrm,tempto,i);break;}    
   }   
   ///////////////////////////////////////////// Starging from n /////////////////////////////////////////////

   ///////////////////////////////////////////// Starging from o /////////////////////////////////////////////
   if (tempfrmAlpha == "o")
   {
    if (temptoAlpha == "p"){tempto = tempto -25 ;i=2;}    
    if (tempfrm == tempto){recFunction(tempfrm,tempto,i);break;}else{recFunction(tempfrm,tempto,i);break;}
   }   
   ///////////////////////////////////////////// Starging from o /////////////////////////////////////////////

   ///////////////////////////////////////////// Starging from a /////////////////////////////////////////////
   if (temptoAlpha == "b"){tempto = tempto -25 ;i=2;}    
   if (temptoAlpha == "c"){tempto = tempto -50 ;i=3;}          
   if (temptoAlpha == "d"){tempto = tempto -75 ;i=4;} 
   if (temptoAlpha == "e"){tempto = tempto -100 ;i=5;}    
   if (temptoAlpha == "f"){tempto = tempto -125 ;i=6;} 
   if (temptoAlpha == "g"){tempto = tempto -150 ;i=7;} 
   if (temptoAlpha == "h"){tempto = tempto -175 ;i=8;}    
   if (temptoAlpha == "i"){tempto = tempto -200 ;i=9;}
   if (temptoAlpha == "j"){tempto = tempto -225 ;i=10;} 
   if (temptoAlpha == "k"){tempto = tempto -250 ;i=11;} 
   if (temptoAlpha == "l"){tempto = tempto -275 ;i=12;} 
   if (temptoAlpha == "m"){tempto = tempto -300 ;i=13;} 
   if (temptoAlpha == "n"){tempto = tempto -325 ;i=14;}
   if (temptoAlpha == "o"){tempto = tempto -350 ;i=15;}
   if (temptoAlpha == "p"){tempto = tempto -375 ;i=16;}         
   
   if (tempfrm == tempto){recFunction(tempfrm,tempto,i);break;}else{recFunction(tempfrm,tempto,i);break;} 
   ///////////////////////////////////////////// Starging from a /////////////////////////////////////////////
  }

  removeFirstColBgStyle();

 });

 function recFunction(rectempfrm,rectempto,loopVar)
 {
  var options   
  options =  $(".sourceplate li");    
  for (i=0;i<loopVar;i++)
  {
   options.slice(rectempfrm,rectempto + 1).addClass("selected");
   rectempfrm = rectempfrm + 25;
   rectempto = rectempto + 25;
  }
 }
 
 //////////// Remove background color for first column [A - P]  ////////////
 function removeFirstColBgStyle()
 { 
   for (i=0;i<=375;i=i+25)
   {
    j= i +1;
    options.slice(i,j).removeClass("selected");
   }
 }
 //////////// Remove background color for first column [A - P]  ////////////  
});
</script>

No comments:

Post a Comment