Results 1 to 7 of 7
Like Tree2Likes
  • 1 Post By PhHein
  • 1 Post By JosAH

Thread: help me with formating txt

  1. #1
    shawngn is offline Member
    Join Date
    Jul 2013
    Posts
    2
    Rep Power
    0

    Default help me with formating txt

    Ok guys I want to change the color of the display txt of the questions and I wish to make that damn review button work sry I am on my phone internet at military is blocked this forum I use all the time never needed to post before






    <script type="text/JavaScript">

    *

    function Questions(divname) {
    ** this.QText** = new Array(21); // The questions
    ** this.QAnswer = new Array(21); // The correct answers
    ** this.QChoice = new Array(84); // The possible multi-choice values
    ** this.thisAns = new Array(10); // The answers for this page
    ** this.Answer* = new Array(10); // The user's answers
    ** this.anchor = document.getElementById(divname);

    *

    *

    *


    *
    ** // OK, set the questions
    ** this.QText[0] = "What is the ref des for the Multi Band Communication System?";
    ** this.QText[1] = "What color ink does the AOC Printer use?";
    ** this.QText[2] = "What is the ref des of the AOC Printer?";
    ** this.QText[3] = "What systems integrate with the AOC Printer?";
    ** this.QText[4] = "What supplies tune power to the HF Coupler?";
    ** this.QText[5] = "What is the LOS range from a ground station for TACAN?";
    ** this.QText[6] = "How much channel separation must be used between aircraft on TACAN?";
    ** this.QText[7] = "What frequency does TACAN transmit on?";
    ** this.QText[8] = "What frequency does TACAN receive on?";
    ** this.QText[9] = "Where does the TACAN R/T receives its power from and how much does it receive?";
    ** this.QText[10] = "The multiband radio consists of what two frequency bands?";
    ** this.QText[11] = "What are the frequency ranges of the multiband radio?";
    ** this.QText[12] = "What amplifies weak signals received by the satcom antenna?";
    ** this.QText[13] = "You control the frequency of the radio by selecting it on the CNC.";
    ** this.QText[14] = "What does the acronym CVR stand for?";
    ** this.QText[15] = "When comm1 does not tune to another frequency, what should the voltage be at pin 25?";
    ** this.QText[16] = "If you can’t transmit on comm1 and the R/T / logic converter check good, what would most likely be the problem?";
    ** this.QText[17] = "Where are the Comm2 antennas located?";
    ** this.QText[18] = "The printer creates hardcopy printouts of what kind of data?";
    ** this.QText[19] = "What is the minimum range a storm can be detected using the Wx Radar?";
    ** this.QText[20] = "The CARA transmits a pulse wave carrier toward the ground.";

    ** // possible answers
    ** this.QChoice[0] = "23-15";
    ** this.QChoice[1] = "23-12";
    ** this.QChoice[2] = "34-15";
    ** this.QChoice[3] = "34-12";* //end q0
    ** this.QChoice[4] = "Black";
    ** this.QChoice[5] = "Red";
    ** this.QChoice[6] = "Blue";
    ** this.QChoice[7] = "None of the above";* //end q1
    ** this.QChoice[8] = "2314AA004";
    ** this.QChoice[9] = "2314AA005";
    ** this.QChoice[10] = "3414AA005";
    ** this.QChoice[11] = "3414AA004";* //end q2
    ** this.QChoice[12] = "Aircrew Data Transfer Device (ADTD), Core Integrated Processors (CIP), AOC Hubs, Underwater Acustics Beacon (UAB)";
    ** this.QChoice[13] = "Aircrew Data Transfer Device (ADTD), Core Integrated Processors (CIP), AOC Hubs, Comm Management Units (CMU)";
    ** this.QChoice[14] = "Aircrew Data Transfer Device (ADTD), Cockpit Voice Recorder (CVR), AOC Hubs, Comm Management Units (CMU)";
    ** this.QChoice[15] = "Aircrew Data Transfer Device (ADTD), Cockpit Voice Recorder (CVR), AOC Hubs, Core Integrated Processors (CIP)"; //end q3
    ** this.QChoice[16] = "HF RT";
    ** this.QChoice[17] = "Power Supply";
    ** this.QChoice[18] = "CCU";
    ** this.QChoice[19] = "APU"; //end q4
    ** this.QChoice[20] = "300 NMI";
    ** this.QChoice[21] = "390 NMI";
    ** this.QChoice[22] = "200 NMI";
    ** this.QChoice[23] = "290 NMI"; //end q5
    ** this.QChoice[24] = "73";
    ** this.QChoice[25] = "53";
    ** this.QChoice[26] = "63";
    ** this.QChoice[27] = "43"; //end q6
    ** this.QChoice[28] = "962-1213 GHz";
    ** this.QChoice[29] = "962-1213 MHz";
    ** this.QChoice[30] = "1025-1150 MHz";
    ** this.QChoice[31] = "1025-1150 GHz"; //end q7
    ** this.QChoice[32] = "1025-1150 MHz";
    ** this.QChoice[33] = "1025-1150 GHz";
    ** this.QChoice[34] = "962-1213 GHz";
    ** this.QChoice[35] = "962-1213 MHz"; //end q8
    ** this.QChoice[36] = "26 VDC power from the AVIONICS DC BUS 1 through the TACAN circuit breaker";
    ** this.QChoice[37] = "26 VDC power from the AVIONICS DC BUS 2 through the TACAN circuit breaker";
    ** this.QChoice[38] = "28 VDC power from the AVIONICS DC BUS 1 through the TACAN circuit breaker";
    ** this.QChoice[39] = "28 VDC power from the AVIONICS DC BUS 2 through the TACAN circuit breaker"; //end q9
    ** this.QChoice[40] = "VHF and UHF";
    ** this.QChoice[41] = "HF and UHF";
    ** this.QChoice[42] = "VHF and HF";
    ** this.QChoice[43] = "All of the above"; //end q10
    ** this.QChoice[44] = "2 – 29.999 MHz/30 – 151.975 MHz";
    ** this.QChoice[45] = "225 – 399.975 MHz/2 – 29.999 MHz";
    ** this.QChoice[46] = "30 – 151.975 MHz/225 – 399.975 MHz";
    ** this.QChoice[47] = "None of the above"; //end q11
    ** this.QChoice[48] = "CCU";
    ** this.QChoice[49] = "LNA (Low Noise Amplifier)";
    ** this.QChoice[50] = "R/T";
    ** this.QChoice[51] = "HPA (High Power Amplifier)"; //end q12
    ** this.QChoice[52] = "True";
    ** this.QChoice[53] = "False";
    ** this.QChoice[54] = "N/A";
    ** this.QChoice[55] = "N/A"; //end q13
    ** this.QChoice[56] = "Cockpit Voice Recorder";
    ** this.QChoice[57] = "Common Voice Recorder";
    ** this.QChoice[58] = "Common Vehical Reciever";
    ** this.QChoice[59] = "Cockpit Voice Reciever"; //end q14
    ** this.QChoice[60] = "<2.5";
    ** this.QChoice[61] = "2.5>";
    ** this.QChoice[62] = "<5";
    ** this.QChoice[63] = "5>"; //end q15
    ** this.QChoice[64] = "Upper Antenna";
    ** this.QChoice[65] = "Switching unit";
    ** this.QChoice[66] = "Lower Antenna";
    ** this.QChoice[67] = "LNA (Low Noise Amplifier)"; //end q16
    ** this.QChoice[68] = "Aft upper fuselage/forward lower fuselage";
    ** this.QChoice[69] = "Forward upper fuselage/aft lower fuselage";
    ** this.QChoice[70] = "Nose radome/tail radome";
    ** this.QChoice[71] = "Forward upper fuselage/forward lower fuselage"; //end q17
    ** this.QChoice[72] = "Textual";
    ** this.QChoice[73] = "Graphic";
    ** this.QChoice[74] = "Both A and B";
    ** this.QChoice[75] = "None of the above"; //end q18
    ** this.QChoice[76] = "320 NMi";
    ** this.QChoice[77] = "20 NMi";
    ** this.QChoice[78] = "150 NMi";
    ** this.QChoice[79] = "80 NMi"; //end q19
    ** this.QChoice[80] = "True";
    ** this.QChoice[81] = "False";
    ** this.QChoice[82] = "N/A";
    ** this.QChoice[83] = "N/A"; //end q20

    ** // Set the correct answers
    ** this.QAnswer[0] = 1;
    ** this.QAnswer[1] = 4;
    ** this.QAnswer[2] = 2;
    ** this.QAnswer[3] = 2;
    ** this.QAnswer[4] = 1;
    ** this.QAnswer[5] = 2;
    ** this.QAnswer[6] = 3;
    ** this.QAnswer[7] = 3;
    ** this.QAnswer[8] = 4;
    ** this.QAnswer[9] = 4;
    ** this.QAnswer[10] = 1; // answers
    ** this.QAnswer[11] = 3;
    ** this.QAnswer[12] = 2;
    ** this.QAnswer[13] = 1;
    ** this.QAnswer[14] = 1;
    ** this.QAnswer[15] = 3;
    ** this.QAnswer[16] = 2;
    ** this.QAnswer[17] = 1;
    ** this.QAnswer[18] = 3;
    ** this.QAnswer[19] = 3;
    ** this.QAnswer[20] = 2;

    }

    Questions.prototype.generateQuiz = function() {
    ** var QCount = 0;
    ** var QNumber = 0;

    ** // Initialise the "questions available" table
    ** var QUsed = new Array(21);
    ** for (QCount=0; QCount<21; QCount++) {
    ***** QUsed[QCount] = 1; // Marked as available
    ** }

    ** // Delete any existing questions
    ** //this.nukeExistingQuiz();
    ** this.anchor.innerHTML = "";

    ** var HTMLBlob = "<table>";

    ** // Build up the questions
    ** for (QCount=0; QCount<10; ) {
    ***** QNumber = Math.floor(21 * Math.random());
    ***** if (1 == QUsed[QNumber]) { // Still available?
    * HTMLBlob += this.AddQuestion(QNumber, QCount);
    * QCount++;
    ******** QUsed[QNumber] = 0; // Marked as unavailable
    ***** }
    ** }
    ** HTMLBlob += "</table>";
    ** this.anchor.innerHTML = HTMLBlob;
    }

    // This nukes the quiz
    Questions.prototype.nukeExistingQuiz = function() {
    ** if (null != this.anchor && null != this.anchor.childCount) {
    ***** while (this.anchor.childCount > 0) {
    ******** this.anchor.removeChild(this.anchor.childNodes[0]);
    ***** }
    ** }
    }

    * // Add this to the DOM
    Questions.prototype.AddQuestion = function(QNum, EntryNum) {
    ** //* you should use DOM stuff, and not non-standard innerHtml ...
    *

    ** var Ix;
    ** var HTMLBlob = "<tr><td><input type=\"checkbox\" id=\"check" + EntryNum + "\" checked=\"checked\"></td><td><br/>"
    ************************************************** ************************************************** ******************************* // (((( + "Question #" + QNum + " + QNum + ":</td><td>"))) inserts question lableling
    ********************** + "<strong>" + this.QText[QNum] + "</strong></td><td><select id=\"answer" + EntryNum + "\" size=\"1\">"
    ********************** + "<option selected=\"selected\" value=\"0\">-- Select an answer --</option>"
    ******
    ********
    ** for (Ix=0; Ix<4; Ix++) {
    ***** HTMLBlob = HTMLBlob + "<option value=\"" + Ix + "\">" + this.QChoice[QNum*4+Ix] + "</option>";
    ** }
    ** HTMLBlob = HTMLBlob + "</select></td></tr>";0
    **
    ** this.thisAns[EntryNum] = this.QAnswer[QNum];
    ** return HTMLBlob;

    }


    // Verify that all questions have been answered
    Questions.prototype.AreQuestionsAnswered = function() {
    ** var unanswered = 0;
    ** for (var Ix=0; Ix<10; Ix++) {
    ***** this.Answer[Ix] = document.getElementById("answer" + Ix).selectedIndex;
    ***** if (this.Answer[Ix] == 0) {
    ******** unanswered++;
    ***** }
    ** }
    ** return unanswered;
    }

    // Score the results
    Questions.prototype.ScoreIt = function() {
    ** var count = this.AreQuestionsAnswered();
    ** if (count > 0) {
    ***** alert("You didn't answer " + count + " questions. Please try again.");
    ***** count = 0;
    ** } else {
    ***** for (var Ix=0; Ix<10; Ix++) {
    ******** if (this.Answer[Ix] == this.thisAns[Ix]) {
    *********** document.getElementById("check" + Ix).checked = true;
    *********** count++;
    ******** } else {
    *********** document.getElementById("check" + Ix).checked = false;
    ******** }
    ***** }
    ***** alert("You got " + count + " correct."); alert("Questions with check marks are correct.\n***** Please click the review button \n********** for more information.");
    ** }
    ** return count;

    }

    *


    *//review the results
    Questions.prototype.review = function() {
    *
    alert ("this button is not currently functioning");
    ********

    *

    }

    *


    ** //makes the invisible buttons appear

    function visibleButton() {

    var buttonToShow = document.getElementById("invisiButton");
    buttonToShow.style.visibility = "visible";

    }

    function visibleButtona() {
    var buttonToShow = document.getElementById("invisiButtona");
    buttonToShow.style.visibility = "visible";
    }


    **

    *


    </script>

    </head><body>

    ** <div id="quizblock"></div>

    ** <script type="text/JavaScript">
    ***** var MyQuiz = new Questions("quizblock");
    ***** MyQuiz.generateQuiz();
    ** </script>

    ** <input type="button" onclick="MyQuiz.ScoreIt();visibleButton();visibleB uttona();" value="Submit">
    ** <input type="button" onclick="MyQuiz.review();" id="invisiButton" value="Review" style="visibility:hidden;">
    ** <input type="button" onclick="document.location.reload(true)";" id="invisiButtona" value="Retake Quiz" style="visibility:hidden;">

    *

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,423
    Rep Power
    20

    Default Re: help me with formating txt

    JavaScript is not Java. You need to find a JavaScript forum. This isn't one.

    And when you do find a suitable place to ask your question, take the time to discover how code should be posted to retain its formatting.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,430
    Rep Power
    7

    Default Re: help me with formating txt

    Wrong forum! Java != javascript.
    FalconDestroyer18 likes this.
    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,423
    Rep Power
    20

    Default Re: help me with formating txt

    Came in second for the second time today, huh? :)
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  5. #5
    shawngn is offline Member
    Join Date
    Jul 2013
    Posts
    2
    Rep Power
    0

    Default Re: help me with formating txt

    No Iv never regerestered.. and thanks guys I never knew that. Lol I feel derpy

  6. #6
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,430
    Rep Power
    7

    Default Re: help me with formating txt

    Came in second for the second time today, huh? :)
    Yep :(
    Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
    The Ubiquitous Newbie Tips

  7. #7
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,663
    Blog Entries
    7
    Rep Power
    21

    Default Re: help me with formating txt

    Quote Originally Posted by DarrylBurke View Post
    Came in second for the second time today, huh? :)
    Indeed, PhHein is terribly slow lately, isn't he? Maybe it would be better for all of us if we gave him a good old 300/75bd dial-up connection to teh internet (he won't notice the difference anyway ;-)

    kindest regards,

    Jos (runs ----------------------------------------------------------------------------------------------------------------------> that'a way)
    PhHein likes this.
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. Table formating in command line
    By siah0wn5a11 in forum New To Java
    Replies: 5
    Last Post: 05-02-2013, 07:40 AM
  2. formating output
    By jwl in forum New To Java
    Replies: 2
    Last Post: 10-13-2012, 01:47 AM
  3. Replies: 9
    Last Post: 05-14-2012, 12:09 PM
  4. Problem with formating comments
    By Lubomirus in forum Eclipse
    Replies: 0
    Last Post: 07-07-2009, 09:37 AM

Posting Permissions

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