Selection Sort - Descending Order - Pseudocode Check
Dec 18, 2011
I am working on a piece of pseudocode for an assignment and as I am new to Javascript, I would like some confirmation I am on the right track with the code.
All of the research I have found has only shown ascending order formulas, so if I am wrong with my if statement and the temp statement and they should i+1 and a[j+1] can you please give a shake of the head; that way I can read my research further and edit my work. If I am on track a nod of the head is a big encouragement.
<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-W3CDTD XHTML 1.1EN" "http:www.w3.org/TR/xhtml1/DTD/xhtml11.dtd"> <!-- -->
[code].....
I am stuck on this I have 2 prompts one for a line of text the other for the user to decide whether it is to be sorted ascending or descending I have ascending order from the first prompt but now I have to make the program listen to the second prmpt and then do what it says. I am stuck I have to declare the prompt -got itand then I believe it is a if statement but how do I reference the Ascending or descending the user puts
OK so Ive been using jquery for a little bit now and love it. I am a ColdFusion developer. I have a need where I would like to present the user with a list of categories and the user can drag and drop to sort, but then I need to post this new sort order to the database. So I see there are a ton of cool drag & drop plugins for jquery. I understand how they work and I can get it to work as far as spitting out DIVS or spitting out ULs that can be sorted, but then what? So now they are sorted on my screen and not really part of the form. How do I translate that into something I can do a post to the database with? Do I do an AJAX call every time they drop an item and try to extrapolate the sort order on that item after they drop it? Do I populate a hidden form field with the constantly updating sort order list? MAybe a list of ID's? How does everyone else go about this this task? I'm sure there is more than one way and I'm sure this is a common task.
I have got a backend PHP script that calls MySQL in order to get town and city names.If I type 'cam' in to the autocomplete textfield, I get something like:
My table columns are sorted by the Tablekit library [URL]. The user can click the columns to toggle the sort order either ascendingly or descendingly. I can save the current sort order (preference) in the server. After the page is refreshed, the web page is sorted by the original sort order. How to make the Tablekit library to sort with the current sort order after page refresh? My web page column is: <th class="sortfirstdesc" id="urgency" onClick="reverseOrder($sortdesc)">ID</th>
I am building a customised javascript prototype to sort an associative array on the array key (in ascending order). Basically, I am separating the array keys into a separate array and then using .sort() to sort the keys and then reassembling the original associative array elements according to the sorted keys array.
The sorting works ok except that when I run the test code below, the outputed sorted associative array has an extra element at the end of the array whose key is the name of the prototype function and the value for that element is the function code itself. Obviously I am misunderstanding something about associative arrays or how javascript prototypes work.
I've been struggling trying to get a small order form to work the way I want it to. Here is a link to the live page: [URL] And here is the code in question:
[Code]...
I have two questions...
Question 1 How can I make this piece of script act a little smarter. Look at the order form, I'm catering for up to 4 people and providing lunch for them. If they select 3 people and the spaghetti bol for lunch, it's only adding $10 where it should be adding $30. Obviously this is simple multiplication but since the values in my form are prices it makes it a little tricky. I'm guessing an onselect on the first part of the form which changes the pricing of the other items would be the way to go, but how do I do this?
Question 2 The "Total Price" is placed before the <form> tag by the script. This is ok but it's not where I want it. How can I position this text elsewhere in the document?
I wrote an application that generates HTML based on some database record set. One of the HTML generated is a checkbox with NAME=StudentID. This is to facilitate user to select this user for further processing. This also means that ALL student have a checkbox named StudentID. I do I ensure that only one checkbox is selected at any time before the user proceed with the processing of the selected student.
Here is the HTML: [URL] I'm trying to uncheck the selected radio button, then set the value to 1 (Yes), basically overwriting theinitialvalue to 1. I've looked at prop(), val(), and attr(), and just don't know where to start. Should I select $('#set_q157 input') or$('#set_q157 input:radio'), or each individual radio?
Do I need to each them, and check if its checked, then change its value, or is there a way to select all three inputs as just one radial button? It would also need to work if the input has not yet been checked.
i have a list of checkboxes, the number of checkboxes is dynamic. All the checkboxes have same name. i am trying to get the length of selected checkboxes.
when i try to get the length in javascript like document.form.name1.length, it works fine if number of checkboxes selected are more than 1, but not for 1.
I have a code that I got from a tutorial website. The goal is when someone clicks the first check box with the value of yes then the two other sets of check boxes will autmatically be checked for no.
The issue is their are three sets of 2 check boxes each.
So here is my code code I am trying to use
PHP Code:
Here is my form code
PHP Code:
So Ideally when a representative clicks that the customer has three services (clicks the Yes checkbox) all the other checkboxes will default to No.
How I would change the above javascript to do this.
I am a php programmer and not a Javascript programmer and I am trying to help a friend out with his shopping cart. The original programmer (who wrote this years ago and is no longer around) has a button that looks up the quantities in the database for the submitted items, and then displays a prompt if you selected a quantity that is less than the minimum purchase amount.The issue is if the user enters a smaller amount than allowed and hits the enter key instead of the "Buy" button, it allows the order.how to use the current code to also check for an Enter key submission.I can handle the PHP and the db lookup for minimum quantities. Here is the page code and the Javascript code.
I have an .asp page for my customers which does just accepts e-mail information and passes this information to another .asp page. But before passing the info, a javascript checks whether the entered e-mail does match some certain rules. Rule1: If any input has been made at all, Rule2: If an "@" sign is there, if the"." is there and so on. upon pressing the submit button, the first rule works but the second rule does not. Could not figure it out why.
[Code]...
It is the function control() which validates the e-mail field. But it just validates whether the e-mail has been entered or not. The second check (with the @ sign) is not being made.
It prints 0,1,...,9, but you cannot see the word "hi". It seems that it prints "hi" then executes the listnum function. But the listnum function is placed before "hi". Could you give me some info on order of execution?
<HEAD> <SCRIPT language=JavaScript> function listnum() { i=0 do { document.write( i + "<br>") i++ } while(i<10) }</SCRIPT> </HEAD>
I've got a page (internal website) that performs some operations, working it's way down a list and putting a tick beside the operation it's just completed (so the user can see where it's got to so far).
Each operation takes a minute or so, and they include things like: adjusting table contents in an Oracle database, performing some Unix server commands etc...
Because of this, the Oracle and Unix parts are handled server-side by php (very easy), but the javascript parts of the page to change the egg-timer to a tick doesn't wait - it just displays ticks down the entire list immediately.
Is there some way to get javascript to wait until the preceding php has completed?
function sortBy(prop,arr) { sortProp=prop; arr=arr.sort(sortFunc); }
function sortFunc(part1,part2) { if (part1[sortProp]>part2[sortProp]) retVal=-1; else if (part1[sortProp]<part2[sortProp]) retVal=1; else retVal=0; return retVal; }
This however allows me to sort only by one criteria. I need to sort by weight first and then by height for those items that have the same weight.
Suppose I have a page with a set of hyperlinks on it. Each time a hyperlink is clicked a new window is opened. What i basically want is the following : I want a counter at the client side which increments each time the user clicks one of those links. At the bottom of the page I'll put a button which should be used to send the value of the counter away.
The problem is I only know server side scripting and have no idea on how to implement such a counter on the client side. I even wonder if it's possible to detect when a link is clicked. The links may be buttons if that would make it easier, it's just that i don't want to reload the page each time a link is clicked but only at the end when the button at the bottom would be clicked.
I'm working on displaying a list of events on my site and need to display them in ascending order. i've got an xml document that looks like this(with multiple events obviously,Can anyone help me with sorting this? So far I have it displaying only events that are occuring after the present date(currentDate). How would I go about displaying them so that the events displayed will be in the order of the earliest date displaying first?