Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-02-2012, 04:17 PM   PM User | #1
JoshEnce
New to the CF scene

 
Join Date: Jan 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
JoshEnce is an unknown quantity at this point
Thumbs down javascript put in order

I have a challenge I gave to myself. I want a script that asks me to put things in order. Say I want a quiz of family, order of age. I have a table with the left cell everybody's name I want a script where I click on a name and it moves over to the right hand cell, up top, then the next clicked named is put under it and so on until all the names are moved over. So far I have this, but I know there is a lot of room for improvment. any suggestions?
<HTML>
<HEAD>
<TITLE>Put Bible books in proper order</TITLE>
</head>

<body>
<h1>Hello World!</h1>
<TABLE BORDER=5><TR><TD>
<FORM NAME="BOOKS">
<script language="javascript" type="text/javascript">
alert('This is what an alert message looks like.');
FUNCTION TESTER() {
ALERT('WORKS');
VAR GOOD=0;
VAR BAD=0;
if (BOOKS.FONE="A") {
GOOD++;
}
ELSE {
BAD++;
};
ALERT("YOU HAVE INCORRECT");
}
</script>

<TABLE BORDER=0><TR><TD>

<TABLE BORDER=1>
<TR><TD><INPUT TYPE="BUTTON" VALUE="Adam" NAME="GONE" onClick="javascript:TEMP.value=this.value";>
<TR><TD><INPUT TYPE="BUTTON" VALUE="Dave" NAME="GTWO" ONCLICK="javascript:TEMP.value=this.value";>
<TR><TD><INPUT TYPE="BUTTON" VALUE="Kile" NAME="GTHREE" ONCLICK="javascript:TEMP.value=this.value";>
<TR><TD><INPUT TYPE="BUTTON" VALUE="John" NAME="GFOUR" ONCLICK="javascript:TEMP.value=this.value;">
<TR><TD><INPUT TYPE="BUTTON" VALUE="Geroge" NAME="GTWO" ONCLICK="javascript:TEMP.value=this.value;">
</TABLE>

<TD VALIGN="CENTER" ALIGN="CENTER" WIDTH=30>
<INPUT TYPE="BUTTON" VALUE=" " NAME="TEMP">
<TD>

<TABLE BORDER=1>
<TR><TD><INPUT TYPE="BUTTON" VALUE="?????" NAME="FONE" ONCLICK="javascript:this.value=TEMP.value;TEMP.value=' '">
<TR><TD><INPUT TYPE="BUTTON" VALUE="?????" NAME="FTWO" ONCLICK="javascript:this.value=TEMP.value;">
<TR><TD><INPUT TYPE="BUTTON" VALUE="?????" NAME="FTHREE" ONCLICK="javascript:this.value=TEMP.value;">
<TR><TD><INPUT TYPE="BUTTON" VALUE="?????" NAME="FFOUR" ONCLICK="javascript:this.value=TEMP.value;">
<TR><TD><INPUT TYPE="BUTTON" VALUE="?????" NAME="FFIVE" ONCLICK="javascript:this.value=TEMP.value;">
</TABLE>

</TABLE>
<INPUT TYPE="BUTTON" NAME="CHECK" onClick="JAVASCRIPT:ALERT()" VALUE="CORRECT???">


</FORM>
</TABLE>
</BODY>
</HTML>
JoshEnce is offline   Reply With Quote
Old 01-02-2012, 08:43 PM   PM User | #2
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,168
Thanks: 59
Thanked 3,992 Times in 3,961 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
All of this code:
Code:
FUNCTION TESTER() {
ALERT('WORKS');
VAR GOOD=0;
VAR BAD=0;
if (BOOKS.FONE="A") {
GOOD++;
}
ELSE {
BAD++;
};
ALERT("YOU HAVE INCORRECT");
}
is completely bogus. JavaScript is CASE SENSITIVE and all keywords in JavaScript must be in lower case.

Examples: function, alert, var.

********

Is this homework for some class?
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is offline   Reply With Quote
Reply

Bookmarks

Tags
arrange, javascript, order, sort

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:53 AM.


Advertisement
Log in to turn off these ads.