Javascript alphabetizer FORM

Ask questions about projects relating to: computer science or pure mathematics (such as probability, statistics, geometry, etc...).

Moderators: MelissaB, kgudger, Ray Trent, Moderators

Javascript alphabetizer FORM

Postby immasink » Sat Mar 02, 2013 2:01 pm

So I have been trying to make a Javascript alphabetizer and here is what i have so far:
<HTML>
<HEAD>
<TITLE>JavaScript Aphabetizer 2013 Science Fair</TITLE>
</HEAD>

<BODY>
2013 Science Fair JavaScript Alphabetizer
<FORM>
<TEXTAREA name="inputText" rows=5 cols=80 wrap=on></TEXTAREA>

<TEXTAREA name="outputText" rows=5 cols=80 wrap=on readonly></TEXTAREA>
</FORM>
</BODY>
</HTML>
I just dont understand where to put .split(), Array, .sort(), and .join(). I have read all of background information and all of chapter one at http://www.webteacher.com/javascript/index.html and I still dont get where to put them. In the form i know but in what order??
Plz help it's due on 3/5/13
immasink
 
Posts: 2
Joined: Sat Mar 02, 2013 1:52 pm
Occupation: Student: 7th grade
Project Question: I am working on ABC's of Programming: Writing a Simple "Alphabetizer" which I use JavaScript to script an alphabetizer usable in browser.
Project Due Date: 3/5/13
Project Status: I am conducting my experiment

Re: Javascript alphabetizer FORM

Postby kgudger » Sun Mar 03, 2013 8:43 pm

Hi:

I think this link might help: http://www.javascriptkit.com/javatutors/arraysort4.shtml

Let us know if this helps.

(Here's some code that might work):
<script type="text/javascript">
function sortvalues(param){
var inputvalues=document.sorter.inputText.value.split(" ")
inputvalues.sort()
document.sorter.inputText.value=''
for (i=0;i<inputvalues.length-1;i++)
document.sorter.inputText.value=document.sorter.inputText.value+inputvalues[i]+" "
document.sorter.inputText.value+=inputvalues[inputvalues.length-1]
}
</script>

<FORM name="sorter">
<TEXTAREA name="inputText" rows=5 cols=80 wrap=on></TEXTAREA><br>
<input type="button" value="Sort alphabetically" onClick="sortvalues(0)">
</FORM>


Keith
kgudger
Moderator
 
Posts: 408
Joined: Wed Sep 17, 2008 9:20 pm
Occupation: electronic engineer
Project Question: n/a
Project Due Date: n/a
Project Status: Not applicable

Re: Javascript alphabetizer FORM

Postby andrikaa » Wed Feb 26, 2014 11:26 pm

I keep getting a message that I need to enable Javascript. Javascript is enabled. I have checked everything I possibly can. I have turned off my firewall and anti virus and still no luck. I have reinstalled the IE and nothing. Any help would be great.
__________________________
fashion police ~ fashion n you
andrikaa
 
Posts: 1
Joined: Thu Feb 13, 2014 12:22 am
Occupation: jhgjmhjnhbjn
Project Question: nmkhgjhgjgh
Project Due Date: 12365478
Project Status: I am just starting


Return to Grades 6-8: Math and Computer Science

Who is online

Users browsing this forum: No registered users and 0 guests