Jump to content

Search the Community

Showing results for tags 'algorithm'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL








Found 3 results

  1. I am building a calendar based on this plugin http://arshaw.com/fullcalendar/I have added a feature where upon selecting a timeslot a popup window appears with a dropdown menu where the time selected will appear therejust like outlook.com calendar.I have managed the above by "taking" the HTML segment(which contains the time in numeric format,,,13:00 for example) of the time slot clicked and "transferring" that to the drop down menu-by selecting a specific value in it.And here is my problem:Every numeric value is hold in this element HTML Code: <div class="fc-event-inner"><div class="fc-event-time">13:00 - 14:00 </div></div> So, I target fc-event-time to get the time-13:00-14:00 here.The issue is that when I go to click another timeslot(and subsequently for the popup window to appear) the time that is "grabbed" is of a timeslot already presentin the calendar....and that because all timeslots have the same class/element you see above.What can I do in such a case?Anyway here is the js code: Code:$('#calendar').on('mouseup', '.fc-event-inner', function () {var timeslot=$('.fc-event-time').html().slice(0,2).replace(":","");//this separates the hours from the minutesif(timeslot>=10)//no need to know what this conditional does for the moment{var tslot=$('.fc-event-time').html().slice(0,5).replace(":","");}else{var tslot=$('.fc-event-time').html().slice(0,4).replace(":","");}$('#times').easyDropDown('select',tslot); //this sets the value at the dropdown menu...easyDropDown is a jquery plugin});
  2. Hello, I'm a beginner and i just wrote an extremely simple program for solving a linear equation. It works, but i was wondering if you guys can take a look. Here it is: <?php$a = 5;$b = 10;$r = -($b/$a);if($a == 0 && $b == 0) {echo 'There are infinitely many solutions';}elseif($a>0 && $b>0) {echo $r;}elseif($a>0 && $b == 0) {echo 'X is equal to zero';}else {echo 'There are no solutions';}?> It's really, really basic and some parts aren't really correct(i guess). Please, tell me what you think. It isn't really complete, because the variable "a", might be a negative number. Also the code isn't exactly the most beautiful one... I didn't make an HTML form, so that the user can write the constants, on purpose.
  3. I'm trying to write an algorithm return an array sorted by a given property in a JSON object. Here's an example of what I want to sort: obj_to_be_sorted = {'four' : {'num' : 4},'one' : {'num' : 1},'three' : {'num' : 3},'two' : {'num' : 2}} sort = function(obj, property, reverse_order) { a = [] for (key in obj) { a.push(key) } return a.sort(a, { /* I think it would involve the sort function... */ }} sorted_array = sort(obj_to_be_sorted, 'num', false); // should return the JSON keys sorted by the 'num' property, i.e. ['one', 'two', 'three', 'four'] I just don't know I would go about doing this. I'm thinking it would be only a few lines of code - very simple - but I'm just not good at writing algorithms yet. I would greatly appreciate any assistance you could give me.
  • Create New...