Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jan 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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>

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    26,576
    Thanks
    80
    Thanked 4,497 Times in 4,461 Posts
    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.


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •