User:Cssaket/sandbox

  function CalculateRate { var weight=document.getElementById('parcelWeight').value; var distance=document.getElementById('txtDistance').value; var rate =0; // write your logic here .... if ((weight>0 &&weight<10) &&(distance>0&&distance<200)) { rate =15; writeRate(rate); } else if ((weight>0 && weight<10) &&(distance>201 &&distance<400)) { rate =20; writeRate(rate); } else if ((weight>0 && weight<10) &&(distance>401&&distance<600)) { rate =25; writeRate(rate); } else if ((weight>0 && weight<10) &&(distance>601 &&distance<800)) { rate =30; writeRate(rate); } else if ((weight>0 && weight<10) &&(distance>801 &&distance<1000)) { rate =35; writeRate(rate); } else if ((weight>0 && weight<10) &&(distance>1001 &&distance<1200)) { rate =40; writeRate(rate); } else if ((weight>0 && weight<10) &&(distance>1201 &&distance<1500)) { rate =45; writeRate(rate); } else if ((weight >11 && weight<20 ) &&(distance>0&&distance<200)) { rate =20; writeRate(rate); } else if ((weight >11 && weight<20 ) &&(distance>201 &&distance<400)) { rate =25; writeRate(rate); } elseif ((weight >11 && weight<20 ) &&(distance>401&&distance<600)) { rate =30; writeRate(rate); } elseif ((weight >11 && weight<20 ) &&(distance>601 &&distance<800)) { rate =35; writeRate(rate); } elseif ((weight >11 && weight<20 ) &&(distance>801 &&distance<1000)) { rate =40; writeRate(rate); } elseif ((weight >11 && weight<20 ) &&(distance>1001 &&distance<1200)) { rate =45; writeRate(rate); } elseif ((weight >11 && weight<20 ) &&(distance>1201 &&distance<1500)) { rate =50; writeRate(rate); } else if ((weight >21 && weight<40 ) &&(distance>0&&distance<200)) { rate =25; writeRate(rate); } else if ((weight >21 && weight<40 ) &&(distance>201 &&distance<400)) { rate =30; writeRate(rate); } else if ((weight >21 && weight<40 ) &&(distance>401&&distance<600)) { rate =35; writeRate(rate); } else if ((weight >21 && weight<40 ) &&(distance>601 &&distance<800)) { rate =40; writeRate(rate); } else if ((weight >21 && weight<40 ) &&(distance>801 &&distance<1000)) { rate =45; writeRate(rate); } else if ((weight >21 && weight<40 ) &&(distance>1001 &&distance<1200)) { rate =50; writeRate(rate); } else if ((weight >21 && weight<40 ) &&(distance>1201 &&distance<1500)) { rate =55; writeRate(rate); } else if ((weight > 41&& weight<60) &&(distance>0&&distance<200)) { rate =30; writeRate(rate); } else if ((weight > 41&& weight<60) &&(distance>201 &&distance<400)) { rate =40; writeRate(rate); } else if ((weight > 41&& weight<60) &&(distance>401&&distance<600)) { rate =50; writeRate(rate); } else if ((weight > 41&& weight<60) &&(distance>601 &&distance<800)) { rate =60; writeRate(rate); } else if ((weight > 41&& weight<60) &&(distance>801 &&distance<1000)) { rate =70; writeRate(rate); } else if ((weight > 41&& weight<60) &&(distance>1001 &&distance<1200)) { rate =80; writeRate(rate); } else if ((weight > 41&& weight<60) &&(distance>1201 &&distance<1500)) { rate =90; writeRate(rate); }            else if ((weight >61&& weight< 80) &&(distance>0&&distance<200)) { rate =35; writeRate(rate); } else if ((weight >61&& weight< 80) &&(distance>201 &&distance<400)) { rate=50; writeRate(rate); } else if ((weight >61&& weight< 80) &&(distance>401&&distance<600)) { rate =65; writeRate(rate); } else if ((weight >61&& weight< 80) &&(distance>601 &&distance<800)) { rate =80; writeRate(rate); } else if ((weight >61&& weight< 80) &&(distance>801 &&distance<1000)) { rate =95; writeRate(rate); } else if ((weight >61&& weight< 80) &&(distance>1001 &&distance<1200)) { rate =110; writeRate(rate); } else if ((weight >61&& weight< 80) &&(distance>1201 &&distance<1500)) { rate =125; writeRate(rate); } else if ((weight >81 && weight<100 ) &&(distance>0&&distance<200)) { rate =40; writeRate(rate); } else if ((weight >81 && weight<100 ) &&(distance>201 &&distance<400)) { rate =60; writeRate(rate); } else if ((weight >81 && weight<100 ) &&(distance>401&&distance<600)) { rate =80; writeRate(rate); } else if ((weight >81 && weight<100 ) &&(distance>601 &&distance<800)) { rate =100; writeRate(rate); } else if ((weight >81 && weight<100 ) &&(distance>801 &&distance<1000)) { rate =120; writeRate(rate); } else if ((weight >81 && weight<100 ) &&(distance>1001 &&distance<1200)) { rate =140; writeRate(rate); } else if ((weight >81 && weight<100 ) &&(distance>1201 &&distance<1500)) { rate =160; writeRate(rate); }

// till here... (better to have a function) }

function writeRate(rate) { document.getElementById('parcelRate').value = rate; }  function CalculateDistance { var fromPlace = document.getElementById('SelectFrom').value; var toPlace = document.getElementById('SelectTo').value; var dist = 0; // write your logic here ....

if ((fromPlace =='Bangalore' && toPlace == 'Mysore')||(fromPlace=='Mysore' && toPlace=='Bangalore')) { dist =139; writeDistance(dist); } else if((fromPlace =='Bangalore' && toPlace =='Mangalore')||(fromPlace=='Mangalore' && toPlace=='Bangalore')) { dist = 347; writeDistance(dist); } else if ((fromPlace =='Bangalore' && toPlace == 'Hyderabad')||(fromPlace=='Hyderabad' && toPlace=='Bangalore')) { dist =562 ; writeDistance(dist); }else if ((fromPlace == 'Bangalore' && toPlace =='Tirupathi')||(fromPlace=='Tirupathi' && toPlace=='Bangalore')) { dist =247 ; writeDistance(dist); }else if ((fromPlace == 'Bangalore' && toPlace =='Vishapatnam')||(fromPlace=='Vishapatnam' && toPlace=='Bangalore')) { dist =999; writeDistance(dist); }else if ((fromPlace == 'Bangalore' && toPlace =='Chennai')||(fromPlace=='Chennai' && toPlace=='Bangalore')) { dist =331; writeDistance(dist); }else if ((fromPlace == 'Bangalore' && toPlace =='Madurai')||(fromPlace=='Madurai' && toPlace=='Bangalore')) { dist =446; writeDistance(dist); }else if ((fromPlace == 'Bangalore' && toPlace =='Coimbatore')||(fromPlace=='Coimbatore' && toPlace=='Bangalore')) { dist =340; writeDistance(dist); }else if ((fromPlace == 'Bangalore' && toPlace =='Trivendrum')||(fromPlace=='Trivendrum' && toPlace=='Bangalore')) { dist =753; writeDistance(dist); }else if ((fromPlace == 'Bangalore' && toPlace =='Cochin')||(fromPlace=='Cochin' && toPlace=='Bangalore')) { dist =533; writeDistance(dist); }else

if ((fromPlace == 'Mysore' && toPlace == 'Mangalore')||(fromPlace=='Mangalore' && toPlace=='Mysore')) { dist =248; writeDistance(dist); }else if ((fromPlace == 'Mysore' && toPlace =='Hyderabad')||(fromPlace=='Hyderabad' && toPlace=='Mysore')) { dist =701; writeDistance(dist); }else if ((fromPlace == 'Mysore' && toPlace =='Tirupathi')||(fromPlace=='Tirupathi' && toPlace=='Mysore')) { dist =386; writeDistance(dist); }else if ((fromPlace == 'Mysore' && toPlace =='Vishapatnam')||(fromPlace=='Vishapatnam' && toPlace=='Mysore')) { dist =1154; writeDistance(dist); }else if ((fromPlace == 'Mysore' && toPlace =='Chennai')||(fromPlace=='Chennai' && toPlace=='Mysore')) { dist =470; writeDistance(dist); }else if ((fromPlace == 'Mysore' && toPlace =='Madurai')||(fromPlace=='Madurai' && toPlace=='Mysore')) { dist =382; writeDistance(dist); }else if ((fromPlace == 'Mysore' && toPlace =='Coimbatore')||(fromPlace=='Coimbatore' && toPlace=='Mysore')) { dist =184; writeDistance(dist); }else if ((fromPlace == 'Mysore' && toPlace =='Trivendrum')||(fromPlace=='Trivendrum' && toPlace=='Mysore')) { dist =598; writeDistance(dist); }else if ((fromPlace == 'Mysore' && toPlace =='Cochin')||(fromPlace=='Cochin' && toPlace=='Mysore')) { dist =388; writeDistance(dist); }else

if ((fromPlace == 'Mangalore' && toPlace =='Hyderabad')||(fromPlace=='Hyderabad' && toPlace=='Mangalore')) { dist =791; writeDistance(dist); }else if ((fromPlace == 'Mangalore' && toPlace =='Tirupathi')||(fromPlace=='Tirupathi' && toPlace=='Mangalore')) { dist =594; writeDistance(dist); }else if ((fromPlace == 'Mangalore' && toPlace =='Vishapatnam')||(fromPlace=='Vishapatnam' && toPlace=='Mangalore')) { dist =1362; writeDistance(dist); }else if ((fromPlace == 'Mangalore' && toPlace =='Chennai')||(fromPlace=='Chennai' && toPlace=='Mangalore')) { dist =678; writeDistance(dist); }else if ((fromPlace == 'Mangalore' && toPlace =='Madurai')||(fromPlace=='Madurai' && toPlace=='Mangalore')) { dist =629; writeDistance(dist); }else if ((fromPlace == 'Mangalore' && toPlace =='Coimbatore')||(fromPlace=='Coimbatore' && toPlace=='Mangalore')) { dist =372; writeDistance(dist); }else if ((fromPlace == 'Mangalore' && toPlace =='Trivendrum')||(fromPlace=='Trivendrum' && toPlace=='Mangalore')) { dist =606; writeDistance(dist); }else if ((fromPlace == 'Mangalore' && toPlace =='Cochin')||(fromPlace=='Cochin' && toPlace=='Mangalore')) { dist =447; writeDistance(dist); }else if ((fromPlace == 'Hyderabad' && toPlace =='Tirupathi')||(fromPlace=='Tirupathi' && toPlace=='Hyderabad')) { dist =592; writeDistance(dist); }else if ((fromPlace == 'Hyderabad' && toPlace =='Vishapatnam')||(fromPlace=='Vishapatnam' && toPlace=='Hyderabad')) { dist =650; writeDistance(dist); }else if ((fromPlace == 'Hyderabad' && toPlace =='Chennai')||(fromPlace=='Chennai' && toPlace=='Hyderabad')) { dist =688; writeDistance(dist); }else if ((fromPlace == 'Hyderabad' && toPlace =='Madurai')||(fromPlace=='Madurai' && toPlace=='Hyderabad')) { dist =1008; writeDistance(dist); }else if ((fromPlace == 'Hyderabad' && toPlace =='Coimbatore')||(fromPlace=='Coimbatore' && toPlace=='Hyderabad')) { dist =902; writeDistance(dist); }else if ((fromPlace == 'Hyderabad' && toPlace =='Trivendrum')||(fromPlace=='Trivendrum' && toPlace=='Hyderabad')) { dist =1315; writeDistance(dist); }else if ((fromPlace == 'Hyderabad' && toPlace =='Cochin')||(fromPlace=='Cochin' && toPlace=='Hyderabad')) { dist =1095; writeDistance(dist); }else

if ((fromPlace == 'Tirupathi' && toPlace =='Vishapatnam')||(fromPlace=='Vishapatnam' && toPlace=='Tirupathi')) { dist =791; writeDistance(dist); }else if ((fromPlace == 'Tirupathi' && toPlace =='Chennai')||(fromPlace=='Chennai' && toPlace=='Tirupathi')) { dist =156; writeDistance(dist); }else if ((fromPlace == 'Tirupathi' && toPlace =='Madurai')||(fromPlace=='Madurai' && toPlace=='Tirupathi')) { dist =596; writeDistance(dist); }else if ((fromPlace == 'Tirupathi' && toPlace =='Coimbatore')||(fromPlace=='Coimbatore' && toPlace=='Tirupathi')) { dist =537; writeDistance(dist); }else if ((fromPlace == 'Tirupathi' && toPlace =='Trivendrum')||(fromPlace=='Trivendrum' && toPlace=='Tirupathi')) { dist =922; writeDistance(dist); }else if ((fromPlace == 'Tirupathi' && toPlace =='Cochin')||(fromPlace=='Cochin' && toPlace=='Tirupathi')) { dist =730; writeDistance(dist); }else if ((fromPlace == 'Vishapatnam' && toPlace =='Chennai')||(fromPlace=='Chennai' && toPlace=='Vishapatnam')) { dist =810; writeDistance(dist); }else if ((fromPlace == 'Vishapatnam' && toPlace =='Madurai')||(fromPlace=='Madurai' && toPlace=='Vishapatnam')) { dist =1254; writeDistance(dist); }else if ((fromPlace == 'Vishapatnam' && toPlace =='Coimbatore')||(fromPlace=='Coimbatore' && toPlace=='Vishapatnam')) { dist =1301; writeDistance(dist); }else if ((fromPlace == 'Vishapatnam' && toPlace =='Trivendrum')||(fromPlace=='Trivendrum' && toPlace=='Vishapatnam')) { dist =1518; writeDistance(dist); }else if ((fromPlace == 'Vishapatnam' && toPlace =='Cochin')||(fromPlace=='Cochin' && toPlace=='Vishapatnam')) { dist =1490; writeDistance(dist); }else if ((fromPlace == 'Chennai' && toPlace =='Madurai')||(fromPlace=='Madurai' && toPlace=='Chennai')) { dist =444; writeDistance(dist); }else if ((fromPlace == 'Chennai' && toPlace =='Coimbatore')||(fromPlace=='Coimbatore' && toPlace=='Chennai')) { dist =491; writeDistance(dist); }else if ((fromPlace == 'Chennai' && toPlace =='Trivendrum')||(fromPlace=='Trivendrum' && toPlace=='Chennai')) { dist =708; writeDistance(dist); }else if ((fromPlace == 'Chennai' && toPlace =='Cochin')||(fromPlace=='Cochin' && toPlace=='Chennai')) { dist =684; writeDistance(dist); }else if ((fromPlace == 'Madurai' && toPlace =='Coimbatore')||(fromPlace=='Coimbatore' && toPlace=='Madurai')) { dist =217; writeDistance(dist); }else if ((fromPlace == 'Madurai' && toPlace =='Trivendrum')||(fromPlace=='Trivendrum' && toPlace=='Madurai')) { dist =264; writeDistance(dist); }else if ((fromPlace == 'Madurai' && toPlace =='Cochin')||(fromPlace=='Cochin' && toPlace=='Madurai')) { dist =270; writeDistance(dist); }else if ((fromPlace == 'Coimbatore' && toPlace =='Trivendrum')||(fromPlace=='Trivendrum' && toPlace=='Coimbatore')) { dist =413; writeDistance(dist); }if ((fromPlace == 'Coimbatore' && toPlace =='Cochin')||(fromPlace=='Cochin' && toPlace=='Coimbatore')) { dist =193; writeDistance(dist); }else if ((fromPlace =='Trivendrum' && toPlace =='Cochin')||(fromPlace=='Cochin' && toPlace=='Trivendrum')) { dist =220; writeDistance(dist); }

// till here... (better to have a function) }

function writeDistance(dist) { document.getElementById('txtDistance').value = dist; }

 From:  Bangalore Mysore Mangalore Hyderabad Tirupathi Vishapatnam Chennai Madurai Coimbatore Trivendrum Cochin

To:  Bangalore Mysore Mangalore Hyderabad Tirupathi Vishapatnam Chennai Madurai Coimbatore Trivendrum Cochin

Distance:  tance: weight: 

Rate: 